~ajk/cash

ref: 08eac3b3e4558b356041aa068b6ee76dc342543b cash/z/jcl/KFRPT2.jcl -rw-r--r-- 5.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
//KFRPT2   JOB 'KFRPT2',
//  NOTIFY=&SYSUID
//STEP1    EXEC PGM=SORT
//SORTIN   DD DSN=AK01DATA.CASH.BACKUP.TXNS(0),DISP=SHR
//SORTOUT  DD DSN=&&SUM1,DISP=(NEW,PASS)
//SYSIN    DD *
  INCLUDE COND=(98,1,CH,EQ,C'F',AND,92,6,PD,GT,+0)
  SORT FIELDS=(1,6,ZD,A)
/*
//SYSOUT   DD SYSOUT=*
//STEP2    EXEC IGYWCLG,
//  PARM.COBOL='LIB'
//COBOL.STEPLIB DD DSN=IGY410.SIGYCOMP,DISP=SHR
//COBOL.SYSLIB DD DSN=AK01.CASH.COBOL,DISP=SHR
//COBOL.SYSIN DD *
       IDENTIFICATION DIVISION.
       PROGRAM-ID. RPT2S2.

       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.
       COPY KFCP1.

       FD  OUT-FILE RECORDING MODE IS F.
       01  OUT-RECORD.
           05  OR-DATE                 PIC 9(8).
           05  OR-DAYS                 PIC S9(7).
           05  OR-PAYEE-NAME           PIC X(30).
           05  OR-AMOUNT               PIC S9(8)V99 USAGE IS
                                         PACKED-DECIMAL.
           05  OR-DESCRIPTION          PIC X(50).
           05  OR-EARLST-FCAST-DATE    PIC 9(8).
           05  OR-EARLST-FCAST-DAYS    PIC S9(7).
           05  OR-PRIMARY-SLIP-REASON  PIC X(2).

       WORKING-STORAGE SECTION.
       01  IN-FILE-EOF-SWITCH          PIC X VALUE 'N'.
           88  IN-FILE-EOF                   VALUE 'Y'.
       01  WS-CURRENT-DATE-TIME        PIC X(20).
       01  WS-CURRENT-DATE             PIC 9(8).
       01  WS-CURRENT-DATE-INTEGER     PIC 9(7).
       01  WS-FILTER-DATE-INTEGER      PIC 9(7).
       01  WS-TR-DATE-INTEGER          PIC 9(7).
       01  WS-OR-EF-DATE-INTEGER       PIC 9(7).

       PROCEDURE DIVISION.
           MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-TIME.
           MOVE WS-CURRENT-DATE-TIME(1:8) TO WS-CURRENT-DATE.
           COMPUTE WS-CURRENT-DATE-INTEGER = FUNCTION
             INTEGER-OF-DATE (WS-CURRENT-DATE).

           COMPUTE WS-FILTER-DATE-INTEGER =
             WS-CURRENT-DATE-INTEGER + 60.

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

           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
               COMPUTE WS-TR-DATE-INTEGER = FUNCTION
                 INTEGER-OF-DATE (TR-DATE)

               IF WS-TR-DATE-INTEGER <= WS-FILTER-DATE-INTEGER
                   PERFORM 1100-GENERATE-OR-RECORD
               END-IF
           END-IF.

       1100-GENERATE-OR-RECORD.
           MOVE TR-DATE TO OR-DATE.
           COMPUTE OR-DAYS = WS-TR-DATE-INTEGER -
             WS-CURRENT-DATE-INTEGER.
           MOVE TR-PAYEE-NAME TO OR-PAYEE-NAME.
           MOVE TR-AMOUNT TO OR-AMOUNT.
           MOVE TR-DESCRIPTION TO OR-DESCRIPTION.

           IF NOT TR-EARLST-FCAST-DATE = ZERO
               MOVE TR-EARLST-FCAST-DATE TO OR-EARLST-FCAST-DATE
           ELSE
               MOVE TR-DATE TO OR-EARLST-FCAST-DATE
           END-IF.

           COMPUTE WS-OR-EF-DATE-INTEGER = FUNCTION
             INTEGER-OF-DATE (OR-EARLST-FCAST-DATE).
           COMPUTE OR-EARLST-FCAST-DAYS = WS-OR-EF-DATE-INTEGER -
             WS-CURRENT-DATE-INTEGER.

           MOVE TR-PRIMARY-SLIP-REASON TO OR-PRIMARY-SLIP-REASON.

           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)
//T1 DD DSN=&&T1,DISP=(,PASS)
//OUTFCNTL DD *
  SORT FIELDS=(1,8,ZD,A,45,6,PD,D)
  OUTREC BUILD=(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'11',C'Dec'),
                C' ',
                7,2,
                C', ',
                1,4,
                9,93,
                106,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'),
                C' ',
                108,2,
                C', ',
                102,4,
                110,9)
/*
//TOOLIN DD *
  COPY FROM(IN) TO(T1) USING(OUTF)
  DISPLAY FROM(T1) LIST(REPORT) NOCC -
    DATE(4MD-) TITLE('60 Day Inflow Forecast') PAGE -
    HEADER('','Date')             ON(1,12,CH) -
    HEADER('','Days')             ON(13,7,ZD,A1,N03,NOST) -
    HEADER('','Payee')            ON(20,30,CH) -
    HEADER('','Amount')           ON(50,6,PD,/C,A1,N07) -
    HEADER('','Description')      ON(56,30,CH) -
    HEADER('Earlst. Fcst.','Date') ON(106,12,CH) -
    HEADER('Earlst. Fcst.','Days') ON(118,7,ZD,A1,N03,NOST) -
    HEADER('Primary Slip','Reason') ON(125,2,CH) -
    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 rpt2.txt
quit
/*
//