Article

Display Graph program DSPGRAPH

Dwight Beech




     F*****************************************************************
     F*                                                               *
     F* Display Graph                                                 *
     F*                                                               *
     F*****************************************************************
     F*                                                               *
     F* RPGDSPGRPH - Display graph with RPGLE and DDS Subfile         *
     F*****************************************************************
     F*                                                               *
     F* FILES USED:                                                   *
     F*  DSPGRAPH - DISPLAY BAR GRAPH VALUES FOR 30 DAY PERIOD        *
     F*    FORMATS- DATASF1, DATACT1, DATAFOOT, DATASF2, DATACT2      *
     F*  DATAFILE - DUMMY DATA FILE                                   *
     F*    FORMAT -                                                   *
     F*                                                               *
     F* DISPLAY FORMAT INDICATORS USED:                               *
     F*      CA03 - EXIT PROGRAM                                      *
     F*        30 - SUBFILE INITIALIZATION                            *
     F*                                                               *
     F* PROGRAM INDICATORS USED:                                      *
     F*        90 - GENERAL PURPOSE                                   *
     F*                                                               *
     F* SUBROUTINES USED:                                             *
     F*    $INIT  - INITIALIZE SUB-FILE                               *
     F*    $FILL  - FILL DATA SUB-FILE                                *
     F*                                                               *
     F*****************************************************************
     F*
     FDSPGRAPH  CF   E             WORKSTN INFDS(WORKS)
     F                                     SFILE(DATASF1:SF)
     F                                     SFILE(DATASF2:SFY)
     F                                     SFILE(DATASF3:SFX)
     FDATAFILE  IF   E           K DISK
     D*
     D MON             S              1    DIM(12) CTDATA PERRCD(1)             MONTH DESC.
     D SHR             S              5  2 DIM(30)                              30 DAY HISTORY
     D SCA             S              5  2 DIM(15)                              Y-AXIS SCALE
     D DTE             S              5    DIM(30)                              30 DAY DATES
     D*
     D WORKS           DS
     D  STDFIL           *FILE
     D  STDFMT           *RECORD
     D  STDLIB                93    102
     D  STCMDK               287    310
     D  STACTN               369    369
     D  STCSRP               370    371B 0
     D  STSFLR               378    379B 0
     D*
     D                SDS
     D  XXUSER               254    263
     D*
     D                 DS
     D  CMO                    1      2
     D  SLSH                   3      3
     D  CDAY1                  4      4
     D  CDAY2                  5      5
     D  @DATE                  1      5
     D*
     D                 DS
     D  @SDA01                 1      1
     D  @SDA06                 2      2
     D  @SDA11                 3      3
     D  @SDA16                 4      4
     D  @SDA21                 5      5
     D  @SDA26                 6      6
     D  @SDA30                 7      7
     D  DAY                    1      7
     D                                     DIM(7)                               DAY FIELDS
     C*
     C*----------------------------------------------------------------
     C*  MAIN PROCESSING LOOP...
     C*----------------------------------------------------------------
     C*   DO UNTIL F3(EXIT) OR F12(PREVIOUS/CALLING PROGRAM)
B1   C     *IN03         DOUEQ     '1'
     C                   EXSR      $INIT
     C                   EXSR      $FILL
     C*
     C*  DISPLAY SCREEN UNTIL F3
B2   C*          *IN03     DOUEQ'1'
     C                   WRITE     DATAFOOT
     C                   WRITE     DATACT3
     C                   WRITE     DATACT2
     C                   WRITE     DATACT1
     C                   READ      DATACT1                                90
     C*
E1   C                   END
     C*
     C*-------------------------
     C*
     C                   MOVE      '1'           *INLR
     C                   RETURN
     C*
     C*----------------------------------------------------------------
     C*----------------------------------------------------------------
     C*--------- SUBROUTINES ------------------------------------------
     C*----------------------------------------------------------------
     C*----------------------------------------------------------------
     C*  INITIALIZE SUB-FILE
     C*----------------------------------------------------------------
     C     $INIT         BEGSR
     C                   MOVE      '1'           *IN30
     C                   WRITE     DATACT1                                       INIT SUB-FILE
     C                   WRITE     DATACT2                                       INIT SUB-FILE
     C                   WRITE     DATACT3                                       INIT SUB-FILE
     C                   MOVE      '0'           *IN30
     C*
     C                   Z-ADD     0             SF                2 0           SUB-FILE KEY
     C                   ENDSR
     C*
     C*----------------------------------------------------------------
     C*  FILL SUB-FILE WITH MONTHLY VALUE AMOUNTS AND CALCULATIONS
     C*----------------------------------------------------------------
     C*
     C     $FILL         BEGSR
     C*
     C*
     C* LOAD SCALE AND CHECK TO SEE WHAT THE HIGHS AND LOWS ARE
     C*
     C                   CLEAR                   SHR
     C                   CLEAR                   SCA
     C                   Z-ADD     0             HIGH              5 2
     C                   Z-ADD     88            LOW               5 2
     C*
     C                   Z-ADD     30            A                 2 0
B1   C     A             DOWNE     0
     C                   READ      RFILE                                  90
     C                   Z-ADD     SXRATE        SHR(A)
     C*
     C* CHECK ON SHARE PRICE - HIGH
     C*
B2   C     SXRATE        IFGE      HIGH
     C                   Z-ADD     SXRATE        HIGH
E2   C                   END
     C*
     C* CHECK ON SHARE PRICE - LOW
     C*
B2   C     SXRATE        IFLE      LOW
     C                   Z-ADD     SXRATE        LOW
E2   C                   END
     C*
     C* LOAD DATES IN DTE ARRAY
     C*
B2   C     A             IFEQ      30
     C     A             OREQ      26
     C     A             OREQ      21
     C     A             OREQ      16
     C     A             OREQ      11
     C     A             OREQ      6
     C     A             OREQ      1
     C                   MOVEL     SXTRDE        DTE(A)
E2   C                   END
     C     A             SUB       1             A
E1   C                   END
     C*
     C* DETERMINE SCALE FACTOR
     C*
     C     HIGH          SUB       LOW           SCTOT             5 2
     C     SCTOT         DIV(H)    15            SCALE             5 2
     C*
     C* LOAD SCA ARRAY WITH AMOUNTS
     C*
B1   C     LOW           IFGE      0
B2   C     1             DO        15            X                 2 0
     C     15            SUB       X             Y                 2 0
     C     Y             ADD       2             Y
     C     SCALE         MULT      Y             TMPSCA            5 2
     C     LOW           ADD       TMPSCA        SCA(X)
E2   C                   END
X1   C                   ELSE
     C                   Z-ADD     0             TMPHGH            5 2
     C     HIGH          ADD       SCALE         TMPHGH
B2   C     1             DO        15            X
     C     15            SUB       X             Y
     C     TMPHGH        SUB       SCALE         SCA(X)
     C                   Z-ADD     SCA(X)        TMPHGH
E2   C                   END
E1   C                   END
     C*-------------------------
     C*
     C*  DO FOR THE 30 DAYS
B1   C     1             DO        15            I                 2 0
     C*
B2   C     31            DO        60            Z                 2 0
     C                   MOVE      '0'           *IN(Z)
E2   C                   END
     C*
B2   C     1             DO        30            B                 2 0
     C*
     C                   Z-ADD     SHR(B)        SHARE             5 2
     C*
     C* READ THROUGH SHR ARRAY AND DETERMINE IF INDICATORS
     C*       31 - 60 SHOULD BE TURNED ON FOR SHARE PRICE
     C*
B3   C     LOW           IFGE      0
B4   C     SHARE         IFGE      SCA(I)
     C     SHARE         ANDNE     0
     C     B             ADD       30            F                 2 0
     C                   MOVE      '1'           *IN(F)
E4   C                   END
X3   C                   ELSE
B4   C     SHARE         IFGE      SCA(I)
     C     SCA(I)        ANDGT     0
     C     B             ADD       30            F                 2 0
     C                   MOVE      '1'           *IN(F)
X4   C                   ELSE
B5   C     SHARE         IFLT      SCA(I)
     C     SCA(I)        ANDLT     0
     C     B             ADD       30            F                 2 0
     C                   MOVE      '1'           *IN(F)
E5   C                   END
E4   C                   END
E3   C                   END
E2   C                   END
     C                   Z-ADD     I             SF                             INCR.RECD.#
     C*
     C* LOAD Y-AXIS VALUES
     C*
     C     15            SUB       SF            TMPSF             2 0
     C     TMPSF         ADD       1             TMPSF
     C     TMPSF         DIV       3             XXTEMP            2 0
     C                   MVR                     XXREM             2 0
B4   C     XXREM         IFEQ      0
     C                   Z-ADD     SCA(I)        @SCALE
E4   C                   END
     C*
     C                   WRITE     DATASF1                                90
     C                   Z-ADD     0             @SCALE
E1   C                   END
     C*
     C* LOAD X-AXIS LINE
     C*
     C                   Z-ADD     1             SFY               1 0
     C                   WRITE     DATASF2                                90
     C*
     C* LOAD X-AXIS VALUES
     C*
B1   C     1             DO        4             V                 1 0
     C                   Z-ADD     V             SFX               1 0
     C                   CLEAR                   DAY
     C                   Z-ADD     0             D                 1 0
B2   C     1             DO        30            A
B3   C     A             IFEQ      1
     C     A             OREQ      6
     C     A             OREQ      11
     C     A             OREQ      16
     C     A             OREQ      21
     C     A             OREQ      26
     C     A             OREQ      30
     C                   MOVEL     DTE(A)        @DATE
     C                   ADD       1             D
     C*
B4   C     V             IFEQ      1
     C                   MOVE      CMO           MO                2 0
     C                   MOVEL     MON(MO)       DAY(D)
E4   C                   END
     C*
B4   C     V             IFEQ      2
     C                   MOVE      '/'           DAY(D)
E4   C                   END
     C*
B4   C     V             IFEQ      3
     C                   MOVE      CDAY1         DAY(D)
E4   C                   END
     C*
B4   C     V             IFEQ      4
     C                   MOVE      CDAY2         DAY(D)
E4   C                   END
E3   C                   END
E2   C                   END
     C                   MOVE      '0'           *IN77
     C     V             IFEQ      4
     C                   MOVE      '1'           *IN77
     C                   END
     C                   WRITE     DATASF3                                90
E1   C                   END
     C                   ENDSR
** PERIOD HEADINGS **
J
F
M
A
M
J
J
A
S
O
N
D

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: