~ajk/cash

ref: 08eac3b3e4558b356041aa068b6ee76dc342543b cash/z/jcl/KFRPT1.jcl -rw-r--r-- 6.8 KiB View raw
08eac3b3 — ajk Modified FTP configuration 6 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//KFRPT1   JOB 'KFRPT1',
//  NOTIFY=&SYSUID
//STEP1    EXEC PGM=SORT
//SYMNAMES DD *
JP0,2014
/*
//SORTIN   DD DSN=AK01DATA.CASH.BACKUP.TXNS(0),DISP=SHR
//SORTOUT  DD DSN=&&SUM1,DISP=(NEW,PASS)
//SYSIN    DD *
  INREC IFTHEN=(WHEN=(98,1,CH,EQ,C'A',AND,92,6,PD,GT,+0),
                BUILD=(1,6,92,6,PD,EDIT=(TTTTTTTTTT),30C'0')),
        IFTHEN=(WHEN=(98,1,CH,EQ,C'F',AND,92,6,PD,GT,+0),
                BUILD=(1,6,10C'0',92,6,PD,EDIT=(TTTTTTTTTT),20C'0')),
        IFTHEN=(WHEN=(98,1,CH,EQ,C'A',AND,92,6,PD,LT,+0),
                BUILD=(1,6,20C'0',92,6,PD,EDIT=(TTTTTTTTTT),10C'0')),
        IFTHEN=(WHEN=(98,1,CH,EQ,C'F',AND,92,6,PD,LT,+0),
                BUILD=(1,6,30C'0',92,6,PD,EDIT=(TTTTTTTTTT))),
        IFOUTLEN=46
  INCLUDE COND=(1,4,ZD,EQ,JP0)
  SORT FIELDS=(1,6,ZD,A)
  SUM FIELDS=(7,10,ZD,17,10,ZD,27,10,ZD,37,10,ZD)
  OUTREC BUILD=(1,4,
                5,2,
                  CHANGE=(3,C'01',C'Jan',
                            C'02',C'Feb',
                            C'03',C'Mar',
                            C'04',C'Apr',
                            C'05',C'May',
                            C'06',C'Jun',
                            C'07',C'Jul',
                            C'08',C'Aug',
                            C'09',C'Sep',
                            C'10',C'Oct',
                            C'11',C'Nov',
                            C'12',C'Dec'),
                7,40)
/*
//SYSOUT   DD SYSOUT=*
//STEP2    EXEC IGYWCLG
//COBOL.STEPLIB DD DSN=IGY410.SIGYCOMP,DISP=SHR
//COBOL.SYSIN DD *
       IDENTIFICATION DIVISION.
       PROGRAM-ID. RPT1S2.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT IN-FILE ASSIGN TO SUMIN
             ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL.

           SELECT OUT-FILE ASSIGN TO SUMOUT
             ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.
       FD  IN-FILE RECORDING MODE IS F.
       01  IN-RECORD.
           05  IR-YEAR                 PIC 9(4).
           05  IR-MONTH-NAME           PIC X(3).
           05  IR-INFLOW-ACTUAL        PIC 9(8)V9(2).
           05  IR-INFLOW-FORECAST      PIC 9(8)V9(2).
           05  IR-OUTFLOW-ACTUAL       PIC 9(8)V9(2).
           05  IR-OUTFLOW-FORECAST     PIC 9(8)V9(2).

       FD  OUT-FILE RECORDING MODE IS F.
       01  OUT-RECORD.
           05  OR-YEAR                 PIC 9(4).
           05  OR-MONTH-NAME           PIC X(3).
           05  OR-INFLOW               PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-INFLOW-ACTUAL        PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-INFLOW-FORECAST      PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-OUTFLOW              PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-OUTFLOW-ACTUAL       PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-OUTFLOW-FORECAST     PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-CASH                 PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-CUMULATIVE-INFLOW    PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-CUMULATIVE-OUTFLOW   PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-INFLOW-TARGET-ATTAINMENT
                                       PIC S9(3) USAGE IS
                                         PACKED-DECIMAL.
           05  OR-RUNWAY               PIC S9(3) USAGE IS
                                         PACKED-DECIMAL.

       WORKING-STORAGE SECTION.
       01  IN-FILE-EOF-SWITCH          PIC X VALUE 'N'.
           88  IN-FILE-EOF                   VALUE 'Y'.
       01  CASH                        PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
       01  CUMULATIVE-INFLOW           PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.
       01  CUMULATIVE-OUTFLOW          PIC S9(8)V9(2) USAGE IS
                                         PACKED-DECIMAL.

       PROCEDURE DIVISION.
           OPEN INPUT IN-FILE.
           OPEN OUTPUT OUT-FILE.

           MOVE ZERO TO CASH.
           MOVE ZERO TO CUMULATIVE-INFLOW.
           MOVE ZERO TO CUMULATIVE-OUTFLOW.

           PERFORM 1000-PROCESS-IN-RECORD UNTIL IN-FILE-EOF.

           CLOSE IN-FILE.
           CLOSE OUT-FILE.

           GOBACK.

       1000-PROCESS-IN-RECORD.
           READ IN-FILE AT END SET IN-FILE-EOF TO TRUE.

           IF NOT IN-FILE-EOF
               PERFORM 1100-GENERATE-OR-RECORD
           END-IF.

       1100-GENERATE-OR-RECORD.
           MOVE IR-YEAR TO OR-YEAR.
           MOVE IR-MONTH-NAME TO OR-MONTH-NAME.

           MOVE IR-INFLOW-ACTUAL TO OR-INFLOW-ACTUAL.
           MOVE IR-INFLOW-FORECAST TO OR-INFLOW-FORECAST.
           COMPUTE OR-INFLOW = IR-INFLOW-ACTUAL + IR-INFLOW-FORECAST.

           MOVE IR-OUTFLOW-ACTUAL TO OR-OUTFLOW-ACTUAL.
           MOVE IR-OUTFLOW-FORECAST TO OR-OUTFLOW-FORECAST.
           COMPUTE OR-OUTFLOW = IR-OUTFLOW-ACTUAL + IR-OUTFLOW-FORECAST.

           COMPUTE CASH = CASH + (OR-INFLOW - OR-OUTFLOW).
           COMPUTE CUMULATIVE-INFLOW = CUMULATIVE-INFLOW + OR-INFLOW.
           COMPUTE CUMULATIVE-OUTFLOW = CUMULATIVE-OUTFLOW + OR-OUTFLOW.

           MOVE CASH TO OR-CASH.
           MOVE CUMULATIVE-INFLOW TO OR-CUMULATIVE-INFLOW.
           MOVE CUMULATIVE-OUTFLOW TO OR-CUMULATIVE-OUTFLOW.

           COMPUTE OR-INFLOW-TARGET-ATTAINMENT = (OR-INFLOW / 11000)
             * 100.

           COMPUTE OR-RUNWAY = FUNCTION INTEGER-PART(CASH / 10500).

           IF OR-RUNWAY < ZERO
               MOVE ZERO TO OR-RUNWAY
           END-IF.

           WRITE OUT-RECORD.
/*
//GO.SUMIN   DD DSN=&&SUM1,DISP=SHR
//GO.SUMOUT  DD DSN=&&SUM2,DISP=(NEW,PASS)
//STEP3    EXEC PGM=ICETOOL
//IN       DD DSN=&&SUM2,DISP=SHR
//REPORT   DD DSN=&&REPORT,DISP=(NEW,PASS)
//TOOLIN  DD *
  DISPLAY FROM(IN) LIST(REPORT) NOCC -
    DATE(4MD-) TITLE('Monthly Summary') PAGE -
    HEADER('','Month')            ON(5,3,CH) -
    HEADER('','Inflow')           ON(8,6,PD,/C,A1,N07) -
    HEADER('Inflow Tgt.','Attnmnt. %') ON(62,2,PD,A0,N03,NOST) -
    HEADER('Cumulative','Inflow') ON(50,6,PD,/C,A1,N07,NOST) -
    HEADER('','Outflow')          ON(26,6,PD,/C,A1,N07) -
    HEADER('','Cash')             ON(44,6,PD,/C,E1,N07,NOST) -
    HEADER('','Runway')           ON(64,2,PD,A0,N02,NOST) -
    TOTAL('Total')
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//STEP4    EXEC PGM=FTP
//REPORT   DD DSN=&&REPORT,DISP=SHR
//SYSIN    DD *
dev1
zftp_cash
zftp_cash
cd incoming/reports
asc
locsite notrailingblanks
sunique on name
put //DD:REPORT rpt1.txt
quit
/*
//