Using SYNCSORT FOR Z/OS 3.1.2.0N
I need to grab some fields out of an EDI group record (structure) and output them in a single record, I do not need to output the incoming records.
Data (cleansed and generic):
0000 ABCDEFG ZZ ET122123456
1000 FA 922401
1000AWU ANOTHER THING HERE
1000AV3 0AB1CD2E
2000 IN123456
2000A
2100 57.000000000000DC20191230
2100AEA92533 012345678000000000000000000
2100AEA92532 012345679000000000000000000
2100AEA92522 012345680000000000000000000
2100AEA92662 012345681000000000000000000
2100AEA921136 012345682000000000000000000
2100AEA921140 012345683000000000000000000
2000 IN123457
2000A
2100 57.000000000000DC20191230
2100AEA92533 012345990012340010000000000
2100AEA92532 012345991012340022012340033
2100AEA92522 012345992000000000000000000
2100AEA92662 012345993000000000000000000
2100AEA921136 012345994000000000000000000
2100AEA921140 012345995000000000000000000
0000 LMNOPQ ZZ ET121123456
1000 FA 921234
1000AWU SOMETHING HERE
1000AV3 123F
2000 IN456789
2000A
2100 188.00000000000DC20191230
2100AEA92522
2100AEA92662
2100AEA921419
2100AEA921457
1000 FA 922401
1000AWU ANOTHER THING HERE
1000AV3 0AB1CD2E
2000 IN123456
2000A
2100 57.000000000000DC20191230
2100AEA92533 012345678000000000000000000
2100AEA92532 012345679000000000000000000
2100AEA92522 012345680000000000000000000
2100AEA92662 012345681000000000000000000
2100AEA921136 012345682000000000000000000
2100AEA921140 012345683000000000000000000
2000 IN123457
2000A
2100 57.000000000000DC20191230
2100AEA92533 012345990012340010000000000
2100AEA92532 012345991012340022012340033
2100AEA92522 012345992000000000000000000
2100AEA92662 012345993000000000000000000
2100AEA921136 012345994000000000000000000
2100AEA921140 012345995000000000000000000
0000 LMNOPQ ZZ ET121123456
1000 FA 921234
1000AWU SOMETHING HERE
1000AV3 123F
2000 IN456789
2000A
2100 188.00000000000DC20191230
2100AEA92522
2100AEA92662
2100AEA921419
2100AEA921457
The group begins with the '0000 ' record, and can have multiple iterations of the '2000 ' through '2100A' block. From one block, to hundreds.
I need to get fields from the '0000 ', '1000 ', '2000 ', and '2100A' records, and output them onto a single record. Bypass/ignore other record types.
The code I have ended up with:
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'0000 '),
PUSH=(390:SEQ=3)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'0000 '),BUILD=(16:46,9)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'1000 '),BUILD=(26:43,4)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'2000 '),BUILD=(31:28,6)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'2100A'),BUILD=(38:18,27))
/*
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'0000 '),
PUSH=(390:SEQ=3)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'0000 '),BUILD=(16:46,9)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'1000 '),BUILD=(26:43,4)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'2000 '),BUILD=(31:28,6)),
IFTHEN=(WHEN=(1,5,CH,EQ,C'2100A'),BUILD=(38:18,27))
/*
The output I get:
122300519
2401
1000AWU ANOTHER THING HERE 003
1000AV3 0AB1CD2E 004
123456
2000A 006
2100 57.000000000000DC20191230 007
012345678000000000000000000
012345679000000000000000000
012345680000000000000000000
012345681000000000000000000
012345682000000000000000000
012345683000000000000000000
123457
2000A 015
2100 57.000000000000DC20191230 016
012345990012340010000000000
012345991000000000000000000
012345992000000000000000000
012345993000000000000000000
012345994000000000000000000
012345995000000000000000000
121123456
1234
1000AWU SOMETHING HERE 003
1000AV3 123F 004
456789
2000A 006
2100 188.00000000000DC20191230 007
012345996000000000000000000
012345997000000000000000000
012345998000000000000000000
012345999000000000000000000
2401
1000AWU ANOTHER THING HERE 003
1000AV3 0AB1CD2E 004
123456
2000A 006
2100 57.000000000000DC20191230 007
012345678000000000000000000
012345679000000000000000000
012345680000000000000000000
012345681000000000000000000
012345682000000000000000000
012345683000000000000000000
123457
2000A 015
2100 57.000000000000DC20191230 016
012345990012340010000000000
012345991000000000000000000
012345992000000000000000000
012345993000000000000000000
012345994000000000000000000
012345995000000000000000000
121123456
1234
1000AWU SOMETHING HERE 003
1000AV3 123F 004
456789
2000A 006
2100 188.00000000000DC20191230 007
012345996000000000000000000
012345997000000000000000000
012345998000000000000000000
012345999000000000000000000
The output I need:
122300519 2401 123456 012345678000000000000000000
122300519 2401 123456 012345679000000000000000000
122300519 2401 123456 012345680000000000000000000
122300519 2401 123456 012345681000000000000000000
122300519 2401 123456 012345682000000000000000000
122300519 2401 123456 012345683000000000000000000
122300519 2401 123457 012345990012340010000000000
122300519 2401 123457 012345991000000000000000000
122300519 2401 123457 012345992000000000000000000
122300519 2401 123457 012345993000000000000000000
122300519 2401 123457 012345994000000000000000000
122300519 2401 123457 012345995000000000000000000
121123456 1234 456789 012345996000000000000000000
121123456 1234 456789 012345997000000000000000000
121123456 1234 456789 012345998000000000000000000
121123456 1234 456789 012345999000000000000000000
122300519 2401 123456 012345679000000000000000000
122300519 2401 123456 012345680000000000000000000
122300519 2401 123456 012345681000000000000000000
122300519 2401 123456 012345682000000000000000000
122300519 2401 123456 012345683000000000000000000
122300519 2401 123457 012345990012340010000000000
122300519 2401 123457 012345991000000000000000000
122300519 2401 123457 012345992000000000000000000
122300519 2401 123457 012345993000000000000000000
122300519 2401 123457 012345994000000000000000000
122300519 2401 123457 012345995000000000000000000
121123456 1234 456789 012345996000000000000000000
121123456 1234 456789 012345997000000000000000000
121123456 1234 456789 012345998000000000000000000
121123456 1234 456789 012345999000000000000000000
I get no errors.
I have been working on this for about a day, and there is something I clearly do not grasp. What am I missing or doing wrong?
Thanks in advance