vijay's blog

By using input file how to read database through easytrive

//XXXXIN DD DSN=XXXXXXX.XXXX.XXXX.XXXXXXXX.XXXXXXXX,DISP=SHR
//XXXXOUT DD DSN=XXXXXXX.XXXX.XXXX.XXXXXXXX.XXXXXXX,
// DCB=(LRECL=XX,RECFM=FB,BLKSIZE=0),
// UNIT=XXXXX,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(XXX,XXX),RLSE)
//SYSIN DD *
* ----------------------------------------------*
* DATA DIVISION SECTION *
* ----------------------------------------------*
FILE ABCDEFGH DLI(ABCDEFGH 1)
PCB-DBD-NAME 1 8 A
PCB-SEGMENT-LEVEL 9 2 A
PCB-STATUS-CODE 11 2 A
PCB-PROC-OPTION 13 4 A
PCB-RESERVE-DLI 17 4 B
PCB-SEGMENT-NAME 21 8 A
PCB-LENGTH-KEY-FB 29 4 B
PCB-NUM-SENS-SEGMENT 33 4 B
PCB-KEY-FB-AREA 37 24 A
*-----------------------------------------------*
* WORKING STORAGE SECTION *
*-----------------------------------------------*
WS-AAA W 2 A
SSA-COUNT W 4 B VALUE 1
FUNCTION W 4 A VALUE 'GN '

%XXXXXXXX

* ----------------------------------------------*
* SSA *
* ----------------------------------------------*
SSA-XXXXXXXX-QUAL W 28 A VALUE 'XXXXXXXX'
SSA-XXXXXXXX-LPA SSA-XXXXXXXX-QUAL +08 1 A VALUE '('
SSA-XXXXXXXX-NME SSA-XXXXXXXX-QUAL +09 8 A VALUE 'XXXXXXXX'
SSA-XXXXXXXX-OPR SSA-XXXXXXXX-QUAL +17 2 A VALUE '= '
SSA-XXXXXXXX-KEY SSA-XXXXXXXX-QUAL +19 8 A
SSA-XXXXXXXX-RPA SSA-XXXXXXXX-QUAL +27 1 A VALUE ')'

FILE FILEIN
OXX-XXT 1 7 N
OXX-ABC 9 5 N
OXX-DEF 14 6 N

FILE FILEOUT
OX1-XXT 1 7 N
OX1-ABC 9 5 A
OX1-DEF 14 6 N

WS-XXX-KEY W 8 A
WS-HH WS-XX-KEY 4 N VALUE 1234
WS-AFEG-AA WS-XXX-KEY +04 4 P 00

XXXX-XXXXX-XXX W 10 A
TEMP-ABT XXXX-XXXXX-XXX 7 N
TEMP-ADI XXXX-XXXXX-XXX +07 1 A VALUE '.'
TEMP-DEC XXXX-XXXXX-XXX +08 2 N

WRX-XXXXX-XXX W 9 A
WRK-ADC WXX-XXXXX-XXX 7 N
WRK-DEC WXX-XXXXX-XXX +07 2 N

WS-XXXXX-ONE W 303 A
ADCD-DEFC WS-XXXXX-ONE +04 2 N
ABCF-AA WS-XXXXX-ONE +04 4 P 00
AAA-ADEF WS-XXXXX-ONE +08 4 P 00

XXXX-STATUS-CODE W 2 A

*-----------------------------------------------*
* PROCEDURE DIVISION SECTION *
*-----------------------------------------------*
JOB INPUT (XXXXIN)

WS-AFEG-AA = OXX-XXT
PERFORM GU-XXXXX-READ

*************************************************
GU-XXXXX-READ. PROC
*************************************************
XXXX-STATUS-CODE = ' '
FUNCTION = 'GU'
SSA-XXXXXXXX-KEY = WS-XXX-KEY
SSA-COUNT = 1
DLI ABCDEFGH AAAAAAAA FUNCTION +
SSANO SSA-COUNT +
SSA (SSA-AAAAAAAA-QUAL)

XXXX-STATUS-CODE = DATABASE-STATUS-CODE

//*The get unique call has been passed to read the database. This will be qualified call //*and upon read the record in database the status code (return code) will be in PCB //*status code. For read success the status code will be ‘spaces’ and no record found //*then ‘GE’.

IF XXXX-STATUS-CODE = ' '
OX1-XXX = OXX-XXT
OX1-ABC = OXX-XXX
OX1-DEF = XXXXXXXX:XXXXXXXX-ADC-IND
//* XXXXXXXX – Database name and XXXXXXXX-ADC-IND – Database field.
PUT XXXXOUT
ELSE
DISPLAY 'END---1:' OXX-XXT
END-IF
END-PROC
//*

//*
//*Read input file and load the data into table through easytrive

//XXXXIN DD DSN=XXXXXXX.XXXX.XXXXX.XXXXX.XXX,
// DISP=SHR
//SYSIN DD *
*
FILE FILEIN
IN-XXX 1 80 A
IN-AAA 1 05 N
IN-BBB 7 08 N
IN-CCC 16 10 N
IN-DDD 28 05 A
IN-EEE 35 02 A

TBL-CNT W 7 N VALUE 0
MAX-CNT W 7 N VALUE 0
*

AA-XXXX-TABLE W 30 A OCCURS 5000
AA-AAA AA-XXXX-TABLE 05 N
AA-BBB AA-XXXX-TABLE +05 08 N
AA-AAA AA-XXXX-TABLE +13 10 N
AA-BBB AA-XXXX-TABLE +23 05 A
AA-AAA AA-XXXX-TABLE +28 02 A

JOB INPUT NULL

//*Input null means when start of job it will not read any input file.

TBL-CNT = 0
DO UNTIL EOF XXXXIN
GET XXXXIN
IF EOF XXXXIN
DISPLAY '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '
DISPLAY ' END OF XXXXIN '
MAX-CNT = TBL-CNT
DISPLAY 'NUM OF LOADED ENTRIES = ' MAX-CNT
DISPLAY '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '
ELSE
TBL-CNT = TBL-CNT + 1
//* Table count increased one by one and the field values from input file will get loaded //*into table.
AA-AAA(TBL-CNT) = IN-AAA
AA-BBB(TBL-CNT) = IN-BBB
AA-CCC(TBL-CNT) = IN-CCC
AA-DDD(TBL-CNT) = IN-DDD
AA-EEE(TBL-CNT) = IN-EEE
END-IF
END-DO
/*
//*

//*Load the input file into table and read another file then match with input file. When //*there is a match found written into one output file and there is no match found //*written into another output file.

//XXXXIN DD DSN=XXXXXXX.XXXX.XXXXX.XXXXX.XXX,
// DISP=SHR
//AAAAA DD DSN=XXXXXXX.XXXX.XXXX.XXXX.XXXXXXX.XXX,
// DISP=SHR
//XXXXXUT DD DSN=XXXXXXX.XXXXXX.XXXXXX.XXXXXXXX.ALL,
// DISP=(NEW,CATLG,DELETE),
// UNIT=XXXXX,SPACE=(CYL,(X,X),RLSE),
// DCB=(RECFM=FB,LRECL=XX,BLKSIZE=0)
//XXXXXU1 DD DSN=XXXXXXX.XXXXXX.XXXXXX.XXXXXXXX.NOT,
// DISP=(NEW,CATLG,DELETE),
// UNIT=XXXXX,SPACE=(CYL,(X,X),RLSE),
// DCB=(RECFM=FB,LRECL=XX,BLKSIZE=0)
//SYSIN DD *
*
FILE XXXXXUT
XX-REC 1 XX A
*
FILE XXXXXU1
XX-REC 1 XX A
*

FILE AAAAA
HH-AAA 1 80 A
HH-BBB 1 07 N
HH-CCC 80 07 N

FILE XXXXIN
IN-XXX 1 80 A
IN-AAA 1 05 N
IN-BBB 7 08 N
IN-CCC 16 10 N
IN-DDD 28 05 A
IN-EEE 35 02 A

TBL-CNT W 7 N VALUE 0
MAX-CNT W 7 N VALUE 0
TOL-CNT W 7 N VALUE 0
AAA-CNT W 11 N VALUE 0
AAA-FLG W 7 A VALUE 'N'
AAA-CNT W 9 N VALUE 0
AAAA-WK W 2 N VALUE 0
AAAV-WK W 2 N VALUE 0
AAP-CNT W 5 N VALUE 0
AAAAX1 W 5 N VALUE 0
AAAAX2 W 5 N VALUE 0
AAA-DEAL W 11 A
*

AA-XXXX-TABLE W 30 A OCCURS 5000
AA-AAA AA-XXXX-TABLE 05 N
AA-BBB AA-XXXX-TABLE +05 08 N
AA-AAA AA-XXXX-TABLE +13 10 N
AA-BBB AA-XXXX-TABLE +23 05 A
AA-AAA AA-XXXX-TABLE +28 02 A

JOB INPUT NULL

//*Input null means when start of job it will not read any input file.

TBL-CNT = 0
DO UNTIL EOF XXXXIN
GET XXXXIN
IF EOF XXXXIN
DISPLAY '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '
DISPLAY ' END OF XXXXIN '
MAX-CNT = TBL-CNT
DISPLAY 'NUM OF LOADED ENTRIES = ' MAX-CNT
DISPLAY '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '
PERFORM MACTH-AAA-BBB
ELSE
TBL-CNT = TBL-CNT + 1
//* Table count increased one by one and the field values from input file will get loaded //*into table.
AA-AAA(TBL-CNT) = IN-AAA
AA-BBB(TBL-CNT) = IN-BBB
AA-CCC(TBL-CNT) = IN-CCC
AA-DDD(TBL-CNT) = IN-DDD
AA-EEE(TBL-CNT) = IN-EEE
END-IF
END-DO
//*
*******************************************
MACTH-AAA-BBB. PROC
*******************************************
DO UNTIL EOF AAAAA
AAA-CNT = AAA-CNT + 1
AAP-CNT = AAP-CNT + 1
IF AAP-CNT >= 5000
DISPLAY ' PROGRESS >> ' AAA-CNT
AAP-CNT = 0
END-IF
GET AAAAA
IF EOF AAAAA
DISPLAY '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '
DISPLAY ' END OF AAAAA '
DISPLAY ' TOTAL AAAAA PROCESSED ' AAA-CNT
DISPLAY '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! '
STOP
ELSE
PERFORM COMPARE-TABLE
END-IF
END-DO
END-PROC.

*******************************************
COMPARE-TABLE. PROC
*******************************************

AAAAX1 = 1
DO WHILE AAAAX1 <= MAX-CNT
IF AA-AAA = AA-AAA(AAAAX1) AND +
AA-BBB = AA-BBB(AAAAX1)
AA-AAA = AA-AAA
PUT XXXXXUT
//* Each record from AAAAA the file that will be matched against the table which loaded //*based on input file (XXXXIN) and write the output file when there is match found //*(XXXXXUT).
ELSE
A1-AAA = AA-AAA
PUT XXXXXU1
//* Each record from AAAAA the file that will be matched against the table which loaded //*based on input file (XXXXIN) and write the output file when there is not match found //*(XXXXXU1).
END-IF

XXXXX1 = XXXXX1 + 1
END-DO
END-PROC.

READ MORE THAN DATABASE THROUGH EASYTRIEVE

//FILEOUT DD DSN=T54V01H.VS1Z.SPA5.REPT,
// DISP=(,CATLG,CATLG),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=27920),
// UNIT=SYSPD,SPACE=(CYL,(50,5),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
*-----------------------------------------------*
* DATA DIVISION SECTION *
*-----------------------------------------------*
FILE HV01BPAA DLI(HV01BPAA 1)
PCB-DBD-NAME 1 8 A
PCB-SEGMENT-LEVEL 9 2 A
PCB-STATUS-CODE 11 2 A
PCB-PROC-OPTION 13 4 A
PCB-RESERVE-DLI 17 4 B
PCB-SEGMENT-NAME 21 8 A
PCB-LENGTH-KEY-FB 29 4 B
PCB-NUM-SENS-SEGMENT 33 4 B
PCB-KEY-FB-AREA 37 24 A

*-----------------------------------------------*
* I/O AREAS *
*-----------------------------------------------*
%HV010IA1
%HV010IA3
%HV010IA5

*-----------------------------------------------*
* SSA-SPA1 *
*-----------------------------------------------*
SSA-HV01SPA1 W 35 A VALUE 'HV01SPA1'
SSA-HV01SPA1-IND SSA-HV01SPA1 +08 1 A VALUE '*'
SSA-HV01SPA1-CC1 SSA-HV01SPA1 +09 1 A VALUE '-'
SSA-HV01SPA1-CC2 SSA-HV01SPA1 +10 1 A VALUE '-'
SSA-HV01SPA1-CC3 SSA-HV01SPA1 +11 1 A VALUE '-'
SSA-HV01SPA1-CC4 SSA-HV01SPA1 +12 1 A VALUE '-'
SSA-HV01SPA1-CC5 SSA-HV01SPA1 +13 1 A VALUE '-'
SSA-HV01SPA1-CC6 SSA-HV01SPA1 +14 1 A VALUE '-'
SSA-HV01SPA1-CC7 SSA-HV01SPA1 +15 1 A VALUE '-'
SSA-HV01SPA1-CC8 SSA-HV01SPA1 +16 1 A VALUE '-'
SSA-HV01SPA1-LPA SSA-HV01SPA1 +17 1 A VALUE '('
SSA-HV01SPA1-NME SSA-HV01SPA1 +18 8 A VALUE 'KV01SPA1'
SSA-HV01SPA1-OPR SSA-HV01SPA1 +26 2 A VALUE '= '
SSA-HV01SPA1-KEY SSA-HV01SPA1 +28 6 A
SSA-HV01SPA1-RPA SSA-HV01SPA1 +34 1 A VALUE ')'
*-----------------------------------------------*
SSA-HV01SPA3-UNQUAL W 09 A VALUE 'HV01SPA3 '
*-----------------------------------------------*
SSA-HV01SPA5-UNQUAL W 11 A VALUE 'HV01SPA5*D '
*-----------------------------------------------*
* INPUT/OUTPUT FILES *
*-----------------------------------------------*
FILE FILEOUT
OUT-REC 01 080 A
OUT-ACCT 01 07 N
OUT-VEH 09 05 A
OUT-BAND-CNT 15 03 N
*-----------------------------------------------*
* WORKING STORAGE SECTION *
*-----------------------------------------------*
FUNCTION W 4 A
SSA-COUNT W 4 B VALUE 1
STATUS-SPA3 W 2 A VALUE ' '
STATUS-SPA5 W 2 A VALUE ' '
WS-INV-VEH W 2 A VALUE ' '
WS-BAND-CNT W 2 N VALUE 0
WS-CNT W 3 N VALUE 0
*-----------------------------------------------*
* PROCEDURE DIVISION SECTION *
*-----------------------------------------------*
JOB INPUT (HV01BPAA)
RETRIEVE HV01BPAA +
SELECT (HV01SPA1 ID 'A1')
IF PATH-ID = 'A1'
WS-CNT = WS-CNT + 1
STATUS-SPA3 = ' '
DO UNTIL STATUS-SPA3 = 'GE'
PERFORM READ-SPA3
END-DO
END-IF
*-----------------------------------------------*
READ-SPA3. PROC
*-----------------------------------------------*
FUNCTION = 'GNP '
SSA-COUNT = 2
SSA-HV01SPA1-KEY = KV01SPA1
DLI HV01BPAA HV01SPA3 FUNCTION +
SSANO SSA-COUNT +
SSA (SSA-HV01SPA1 +
SSA-HV01SPA3-UNQUAL)
STATUS-SPA3 = PCB-STATUS-CODE
IF STATUS-SPA3 = ' '
WS-INV-VEH = CINVSVHC-INV-VEH
IF WS-INV-VEH = 'FB'
WS-BAND-CNT = 0
DO UNTIL STATUS-SPA5 = 'GE'
PERFORM READ-SPA5
END-DO
ELSE
GO TO JOB
END-IF
END-IF
END-PROC.
*-----------------------------------------------*
READ-SPA5. PROC
*-----------------------------------------------*
FUNCTION = 'GNP '
SSA-COUNT = 3
SSA-HV01SPA1-KEY = KV01SPA1
DLI HV01BPAA HV01SPA5 FUNCTION +
SSANO SSA-COUNT +
SSA (SSA-HV01SPA1 +
SSA-HV01SPA3-UNQUAL +
SSA-HV01SPA5-UNQUAL)
STATUS-SPA5 = PCB-STATUS-CODE
IF STATUS-SPA5 = ' '
WS-BAND-CNT = WS-BAND-CNT + 1
END-IF
IF WS-BAND-CNT > 50
OUT-ACCT = ZPRTPACT-PART-ACCT-NO
OUT-VEH = CINVSVHC-INV-VEH
OUT-BAND-CNT = WS-BAND-CNT
PUT FILEOUT
END-IF
END-PROC.
/*

USING INPUT FILE READ MULTIPLE DATABASE THROUGH EASYTRIEVE

//FILEIN DD DSN=T54V01H.VSRJ.FB003.SSN,
// DISP=SHR
//FILEOUT DD DSN=T54V01H.VSRJ.WITHZE.MIX,
// DISP=(,CATLG,CATLG),
// DCB=(LRECL=100,RECFM=FB,BLKSIZE=0),
// UNIT=SYSPD,SPACE=(CYL,(100,10),RLSE)
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
* ----------------------------------------------*
* DATA DIVISION SECTION *
* ----------------------------------------------*
FILE HV01BPAA DLI(HV01BPAA 1)
PCB-DBD-NAME 1 8 A
PCB-SEGMENT-LEVEL 9 2 A
PCB-STATUS-CODE 11 2 A
PCB-PROC-OPTION 13 4 A
PCB-RESERVE-DLI 17 4 B
PCB-SEGMENT-NAME 21 8 A
PCB-LENGTH-KEY-FB 29 4 B
PCB-NUM-SENS-SEGMENT 33 4 B
PCB-KEY-FB-AREA 37 24 A
%HV010IA1
%HV010IA3
%HV010IAI
%HV010IA4

*-----------------------------------------------*
* SSA-QUAL *
*-----------------------------------------------*
SSA-HV01SPA1 W 35 A VALUE 'HV01SPA1'
SSA-HV01SPA1-IND SSA-HV01SPA1 +08 1 A VALUE '*'
SSA-HV01SPA1-CC1 SSA-HV01SPA1 +09 1 A VALUE '-'
SSA-HV01SPA1-CC2 SSA-HV01SPA1 +10 1 A VALUE '-'
SSA-HV01SPA1-CC3 SSA-HV01SPA1 +11 1 A VALUE '-'
SSA-HV01SPA1-CC4 SSA-HV01SPA1 +12 1 A VALUE '-'
SSA-HV01SPA1-CC5 SSA-HV01SPA1 +13 1 A VALUE '-'
SSA-HV01SPA1-CC6 SSA-HV01SPA1 +14 1 A VALUE '-'
SSA-HV01SPA1-CC7 SSA-HV01SPA1 +15 1 A VALUE '-'
SSA-HV01SPA1-CC8 SSA-HV01SPA1 +16 1 A VALUE '-'
SSA-HV01SPA1-LPA SSA-HV01SPA1 +17 1 A VALUE '('
SSA-HV01SPA1-NME SSA-HV01SPA1 +18 8 A VALUE 'KV01SPA1'
SSA-HV01SPA1-OPR SSA-HV01SPA1 +26 2 A VALUE '= '
SSA-HV01SPA1-KEY SSA-HV01SPA1 +28 6 A
SSA-HV01SPA1-RPA SSA-HV01SPA1 +34 1 A VALUE ')'

SSA-HV01SPA3 W 34 A VALUE 'HV01SPA3'
SSA-HV01SPA3-IND SSA-HV01SPA3 +08 1 A VALUE '*'
SSA-HV01SPA3-CC1 SSA-HV01SPA3 +09 1 A VALUE '-'
SSA-HV01SPA3-CC2 SSA-HV01SPA3 +10 1 A VALUE '-'
SSA-HV01SPA3-CC3 SSA-HV01SPA3 +11 1 A VALUE '-'
SSA-HV01SPA3-CC4 SSA-HV01SPA3 +12 1 A VALUE '-'
SSA-HV01SPA3-CC5 SSA-HV01SPA3 +13 1 A VALUE '-'
SSA-HV01SPA3-CC6 SSA-HV01SPA3 +14 1 A VALUE '-'
SSA-HV01SPA3-CC7 SSA-HV01SPA3 +15 1 A VALUE '-'
SSA-HV01SPA3-CC8 SSA-HV01SPA3 +16 1 A VALUE '-'
SSA-HV01SPA3-LPA SSA-HV01SPA3 +17 1 A VALUE '('
SSA-HV01SPA3-NME SSA-HV01SPA3 +18 8 A VALUE 'KV01SPA3'
SSA-HV01SPA3-OPR SSA-HV01SPA3 +26 2 A VALUE '= '
SSA-HV01SPA3-KEY SSA-HV01SPA3 +28 5 A
SSA-HV01SPA3-RPA SSA-HV01SPA3 +33 1 A VALUE ')'

SSA-HV01SPA4 W 33 A VALUE 'HV01SPA4'
SSA-HV01SPA4-IND SSA-HV01SPA4 +08 1 A VALUE '*'
SSA-HV01SPA4-CC1 SSA-HV01SPA4 +09 1 A VALUE '-'
SSA-HV01SPA4-CC2 SSA-HV01SPA4 +10 1 A VALUE '-'
SSA-HV01SPA4-CC3 SSA-HV01SPA4 +11 1 A VALUE '-'
SSA-HV01SPA4-CC4 SSA-HV01SPA4 +12 1 A VALUE '-'
SSA-HV01SPA4-CC5 SSA-HV01SPA4 +13 1 A VALUE '-'
SSA-HV01SPA4-CC6 SSA-HV01SPA4 +14 1 A VALUE '-'
SSA-HV01SPA4-CC7 SSA-HV01SPA4 +15 1 A VALUE '-'
SSA-HV01SPA4-CC8 SSA-HV01SPA4 +16 1 A VALUE '-'
SSA-HV01SPA4-LPA SSA-HV01SPA4 +17 1 A VALUE ' '
SSA-HV01SPA4-NME SSA-HV01SPA4 +18 8 A VALUE 'KV01SPA4'
SSA-HV01SPA4-OPR SSA-HV01SPA4 +26 2 A VALUE '= '
SSA-HV01SPA4-KEY SSA-HV01SPA4 +28 4 A
SSA-HV01SPA4-RPA SSA-HV01SPA4 +32 1 A VALUE ')'

SPA1-STATUS-CODE W 2 A VALUE ' '
SPA3-STATUS-CODE W 2 A VALUE ' '
SPAI-STATUS-CODE W 2 A VALUE ' '
SPA4-STATUS-CODE W 2 A VALUE ' '
SPA1-REPLACE-CODE W 2 A VALUE ' '
SPA3-REPLACE-CODE W 2 A VALUE ' '
SPAI-REPLACE-CODE W 2 A VALUE ' '
SPA4-REPL-CODE W 2 A VALUE ' '

SSA-HV01SPA3-UNQUAL W 09 A VALUE 'HV01SPA3 '

MIX-EFFDT W 7 N
PYMNT-STR W 2 A
MIX-ALLOC W 5 N 2

SSA-COUNT W 4 B VALUE 1
CTR W 6 N
FUNCTION W 4 A
COUNTER W 4 N
OUTPUT-WRITTEN W 1 A

FILE FILEIN
IN-REC 01 134 A
I1-ACCT 01 07 N
I1-VEH 13 05 A
I1-MIX-FB003 27 05 N 2
I1-MIX-FB001 66 05 N 2
I1-PART-SSN 84 09 N
FILE FILEOUT
O1-OUT-REC 01 80 A
O1-ACCT 01 07 N
O1-SSN 09 09 N
O1-PRO-DATE 19 07 N
O1-PRO-TIME 27 10 N
O1-EFF-DATE 38 07 N
O1-VEH-CODE 46 05 A
O1-NEW-PCT 52 05 N 2
O1-OPR-ID 58 07 A

CTR1 W 8 N 0
DTR1 W 8 N 0
ETR1 W 8 N 0
FTR1 W 8 N 0
*-----------------------------------------------*
* WORKIN STORAGE SECTION *
*-----------------------------------------------*
WS-PRO-DATE W 07 N VALUE 2110511
WS-PRO-TIME W 10 N VALUE 0000131737
WS-EFF-DATE W 07 N VALUE 2110511
WS-OPR-ID W 07 A VALUE 'FNDSUBY'
WS-SPA1-KEY W 6 A
W-PROC-COMP WS-SPA1-KEY 2 N VALUE 54
W-PART-ACCT-NO WS-SPA1-KEY +2 4 P 00

WS-SPA3-KEY W 5 A
WS-INV-VEH W 5 A
WS-INV-C W 5 A

WS-VEHICLE W 5 A
WS-VEH-PART1 WS-VEHICLE 1 A
WS-VEH-PART2 WS-VEHICLE +1 4 A
*-----------------------------------------------*
* PROCEDURE DIVISION SECTION *
*-----------------------------------------------*
JOB INPUT (FILEIN)

W-PART-ACCT-NO = I1-ACCT
SSA-HV01SPA1-KEY = WS-SPA1-KEY

SSA-COUNT = 1
FUNCTION = 'GU '

SPA1-STATUS-CODE = ' '
SPA4-STATUS-CODE = ' '

DLI HV01BPAA HV01SPA1 FUNCTION +
SSANO SSA-COUNT +
SSA (SSA-HV01SPA1)

SPA1-STATUS-CODE = PCB-STATUS-CODE
IF SPA1-STATUS-CODE = ' '
SPA3-STATUS-CODE = ' '
DO WHILE SPA3-STATUS-CODE = ' '
PERFORM GETNEXT-SPA3
END-DO
ELSE
DISPLAY 'A1 GET FAILED:' SPA1-STATUS-CODE
END-IF

*-----------------------------------------------*
GETNEXT-SPA3. PROC
*-----------------------------------------------*

SSA-COUNT = 2
FUNCTION = 'GNP'

DLI HV01BPAA HV01SPA3 FUNCTION +
SSANO SSA-COUNT +
SSA (SSA-HV01SPA1 +
SSA-HV01SPA3-UNQUAL)

SPA3-STATUS-CODE = PCB-STATUS-CODE
IF SPA3-STATUS-CODE = ' '
WS-INV-VEH = CINVSVHC-INV-VEH
PERFORM READ-SPA4
IF SPA4-STATUS-CODE = ' '
O1-ACCT = I1-ACCT
O1-SSN = I1-PART-SSN
O1-PRO-DATE = WS-PRO-DATE
O1-PRO-TIME = WS-PRO-TIME
O1-EFF-DATE = WS-EFF-DATE
O1-VEH-CODE = WS-INV-VEH
O1-NEW-PCT = MIX-ALLOC
O1-OPR-ID = WS-OPR-ID
PUT FILEOUT
MIX-ALLOC = 0
ELSE
IF SPA4-STATUS-CODE = 'GE'
DISPLAY 'FB001 NOT FOUND ' I1-ACCT
END-IF
END-IF
ELSE
DISPLAY 'A3 GET FAILED:' SPA3-STATUS-CODE
END-IF
END-PROC.
*-----------------------------------------------*
READ-SPA4. PROC
*-----------------------------------------------*
OUTPUT-WRITTEN = 'N'
FUNCTION = 'GNP '
SSA-HV01SPA3-KEY = WS-INV-VEH
SSA-COUNT = 3
SSA-HV01SPA4-IND = ' '
DLI HV01BPAA HV01SPA4 FUNCTION +
SSANO SSA-COUNT +
SSA (SSA-HV01SPA1 +
SSA-HV01SPA3 +
SSA-HV01SPA4)
SPA4-STATUS-CODE = PCB-STATUS-CODE

IF SPA4-STATUS-CODE = ' '
IF WS-INV-VEH = 'FB001'
MIX-ALLOC = (PCTMXPCT-CTMX-PCT + I1-MIX-FB003)
ELSE
IF WS-INV-VEH = 'FB003'
MIX-ALLOC = 0
ELSE
IF PCTMXPCT-CTMX-PCT > 0
MIX-ALLOC = PCTMXPCT-CTMX-PCT
DISPLAY 'OTHERVH' PCTMXPCT-CTMX-PCT
END-IF
END-IF
END-IF
END-IF

END-PROC.

Is it possible to have is numeric check in easytrive? How it can be used?

FILE INXXXX FB (XXX XXXXX)
IN-XXXXXX-RE 1 12 A
IN-CXXE 14 02 A
AN-COUNT 17 07 N
AA-DD 35 02 N
AA-MMM 38 03 A
AA-YYYY 42 04 N

FILE OUTXXXX FB (XXX XXXXX)
XXT-DATE 1 11 A
XXT-XXXXXX-RE 1 12 A
XXT-XXDE 14 02 A
AUT-COUNT 17 07 N

WS-I W 2 N
WS-AAAA W 11 A
WS-DD WS-AAAA 02 N
WS-FL WS-AAAA +02 01 A VALUE '-'
WS-MMM WS-AAAA +03 03 A
WS-FL1 WS-AAAA +06 01 A VALUE '-'
WS-YYYY WS-AAAA +07 04 N
WS-CNT W 2 N
WS-COUNT W 1 A
WS-RECORD-RE W 12 A VALUE 'XXXS-XXXXTEN'
WS-XXXX-TABLE W 21 A OCCURS 20
WS-RECORD-RE1 WS-XXXX-TABLE 12 A
WS-XXXXA WS-XXXX-TABLE +12 02 A
WS-AAAAAA WS-XXXX-TABLE +17 07 N

***********************************************************
JOB INPUT INXXXX
IF AA-DD NUMERIC AND AA-YYYY NUMERIC
WS-DD = AA-DD
WS-MMM = AA-MMM
WS-YYYY = AA-YYYY
AAT-AADE = WS-AAAA
PUT OUTXXXX
END-IF
IF AA-DD NUMERIC AND AA-YYYY NUMERIC AND +
AA-DD NE WS-DD AND AA-YYYY NE WS-YYYY AND WS-MMM NE AA-MMM
WS-COUNT = 'N'
END-IF
IF AN-XXXXXX-RE = 'XXXS-XXXXTEN'
WS-CNT = WS-CNT + 1
IF WS-CNT > 10
WS-COUNT = 'Y'
END-IF
IF WS-COUNT = 'Y'
AUT-XXXXXX-XE = AN-XXXXXX-RE
AAT-XXXE = XX-XXDE
AAT-COUNT = AN-COUNT
PUT OUTXXXX
WS-CNT = 0
END-IF
END-IF
//*

//*VALUE CLAUSE CAN BE USED IN EASYTRIEVE WHILE DECLARING VARIABLES

How to use subscript in easytrive

//XXXXIN DD DISP=SHR,DSN=XXXXXXX.XXXX.XXXX.XXX.XXXX
//XXXXXUT DD DSN=XXXXXXX.XXXX.XXXX.XXX.XXXXXXX,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(XXX,XX),RLSE),
// DCB=(LRECL=XX,RECFM=FB,BLKSIZE=0),UNIT=XXXXX
//SYSIN DD *

FILE XXXXIN
IN-XXT 21 4 P 00
ABC-XXXX 0050 0030 A OCCURS 050
XXXXXXXX-FIL ABC-XXXX 04 A
XXXXXXXX-ACV-DEF ABC-XXXX +4 05 A
XXXXXXXX-XXXX-XXA ABC-XXXX +9 05 P 02
*
FILE XXXXXUT
XXX-XXC 01 80 A
OXX-XXX 1 7 N
OXX-XXXX-XXX-ABC 9 5 A
OXX-XXX-DEF 15 11 N 2

WS-XXXC W 01 A
WS-XXE-HXT W 11 N 2 VALUE 0
H W 03 N 0

JOB INPUT FILEIN
H = 1
WS-XXXC = 'N'
XXX-REC = ' '
DO WHILE WS-XXXC = 'N'
IF XXXXXXXX-ACV-DEF (H) = 'ABCDE'
OXX-XXX = IN-XXT
OXX-XXXX-XXX-ABC = XXXXXXXX-ACV-DEF (H)
OUT-XXX-DEF = XXXXXXXX-XXXX-XXA (H)
PUT XXXXXUT
GO TO JOB
END-IF
H = H + 1
IF XXXXXXXX-ACV-DEF (H) = ' '
GO TO JOB
END-IF
END-DO
//*

How to WRITE group data in output file by using easytrive

//XXXXIN DD DISP=SHR,DSN=XXXXXXX.XXXX.XXXXX.XXX
//XXXXOUT DD DSN=XXXXXXX.XXXX.XXXXXXXX.XXXXXXXX.XXXX,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(XXX,XXX),RLSE),
// DCB=(LRECL=XXX,RECFM=XX,BLKSIZE=0),UNIT=XXXXX
//SYSIN DD *

FILE XXXXIN
IN-XXX-XXXXXX 03 4 P 00
XXXXXXXX-XXXXX-XXDE 0012 0003 A
XXXXXXXX-XXX-XXXX-XCCUR 0032 0002 P 00
XXX-XXXA 0034 0038 A OCCURS 0100
XXXXXXXX-XXX-XXH XXX-XXXA 05 A
XXXXXXXX-XXXX-XMT XXX-XXXA +5 05 P 02
XXXXXXXX-XXXXX-XXXXXE XXX-XXXA +10 05 P 02
XXXXXXXX-XXXX-XXX-XD XXX-XXXA +15 05 P 02
XXXXXXXX-XX-XXX-XXX-XXED XXX-XXXA +20 05 P 02
XXXXXXXX-XXXXXX-XXX-XXYD XXX-XXXA +25 05 P 02
XXXXXXXX-XXXX-XXXUE XXX-XXXA +30 05 P 06
XXXXXXXX-XXXXX-XXXXXXSED XXX-XXXA +37 07 P 06
XXXXXXXX-XXXXXXXX-XXDE XXX-XXXA +38 01 A

//*Here the group data is XXX-XXXA and group data start position is 34 / record length is //*38 / occurrence of 100 times

*
FILE XXXXOUT
XXX-XXC 01 XXX A
XXT-XXXXXM 1 7 N
XXT-XXX-XXT 10 11 N 2
XXX-XXX-XXXX-OCCUR 23 02 P 00
XXX-XXX-XXTA 26 10 A OCCURS 0100
XXX-XXXX-XXX-YXH XXX-XXX-XXTA 05 A
XXX-XXXG-XXXXX-XXXXXX-XXT XXX-XXX-XXTA +5 05 P 02

//*Here the group data is XXX-XXTA and group data start position is 26 / record length is //*10 / occurrence of 100 times

WS-COUNT W 09 N
WS-XXX-XXT W 11 N 2
I W 03 N 0

JOB INPUT FILEIN FINISH DISPLAY-PARA.
IF XXXXXXXX-XXXXX-XXDE = 'AAA'
WS-XXX-XXT = 0
A = 1
XXX-XXC = ' '
DO WHILE A LE XXXXXXXX-XXX-XXXX-OCCUR
XXXXXXXX-XXXXX-XXXXXX-XMT (A) = +
XXXXXXXX-XXXXX-XXXXXX-XMT (A) * -1
WS-XXX-XXT = WS-XXX-XXT + XXXXXXXX-XXXXX-XXXXXX-XMT (A)
XXX-XXXX-XXX-XXH (I) = XXXXXXXX-XXX-XXH (A)
XXX-XXXX-XXXXX-XXXXXX-XMT (A) = +
XXXXXXXX-XXXXX-XXXXXX-XMT (A)
A = A + 1
END-DO
//*The output file variable will be loaded based on input file group data. The working //*storage field WS-XXX-XMT will be added for each record and it will be written in //*output file.
XXT-XXXXXM = IN-XXX-XXXXXM
OUT-XXX-XXT = WS-XXX-XXT
XXX-XXX-XXXX-OCCUR = XXXXXXXX-XXX-XXXX-XCCUR
PUT XXXXOUT
WS-COUNT = WS-COUNT + 1
END-IF

*

//*Once end of the file reached this para will perform and display how many records were //*written into output file.

DISPLAY-PARA. PROC
DISPLAY 'FIND : ' WS-CNT1
END-PROC
//*

Syndicate content