Thanks a lot. I went by your instructions and got stuck at
OUTFIL, define another GROUP (same technique) and PUSH the ID to another position,
Pasted below is the piece of code and the output obtained at each scenario.
Source code:-
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(41:SEQNUM,8,ZD,
RESTART=(1,8))),
SORT FIELDS=COPY
OVERLAY=(41:SEQNUM,8,ZD,
RESTART=(1,8))),
SORT FIELDS=COPY
Output:-
00001234 TEST1 TESTING 00000001
00001234 DESCRIPTION 00000002
00001234 TESTDUPL 00000003
00003456 TYPE2 TESTER2 00000001
00003456 DESC1 00000002
00003456 DESC2 00000003
00003456 DESC3 00000004
00004567 ERROR1 ERROR DESC1 00000001
00004567 DESC2 00000002
00004567 DESC3 00000003
00001234 TEST1 TESTER1 00000001
00001234 EXAMPLE1 00000002
00003456 TYPE2 TESTER2 00000001
00003456 EXAMPLE2 00000002
00004567 ERROR1 DESC LINE1 00000001
00004567 DESC LINE2 00000002
00001234 TEST1 TESTSAMP 00000001
00001234 SAMPLE1 00000002
00001234 DESCRIPTION 00000002
00001234 TESTDUPL 00000003
00003456 TYPE2 TESTER2 00000001
00003456 DESC1 00000002
00003456 DESC2 00000003
00003456 DESC3 00000004
00004567 ERROR1 ERROR DESC1 00000001
00004567 DESC2 00000002
00004567 DESC3 00000003
00001234 TEST1 TESTER1 00000001
00001234 EXAMPLE1 00000002
00003456 TYPE2 TESTER2 00000001
00003456 EXAMPLE2 00000002
00004567 ERROR1 DESC LINE1 00000001
00004567 DESC LINE2 00000002
00001234 TEST1 TESTSAMP 00000001
00001234 SAMPLE1 00000002
Source code:-
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(41:SEQNUM,8,ZD,
RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,
BEGIN=(41,8,CH,EQ,C'00000001'),
PUSH=(50:ID=8))
SORT FIELDS=COPY
OVERLAY=(41:SEQNUM,8,ZD,
RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,
BEGIN=(41,8,CH,EQ,C'00000001'),
PUSH=(50:ID=8))
SORT FIELDS=COPY
Output:-
00001234 TEST1 TESTING 00000001 00000001
00001234 DESCRIPTION 00000002 00000001
00001234 TESTDUPL 00000003 00000001
00003456 TYPE2 TESTER2 00000001 00000002
00003456 DESC1 00000002 00000002
00003456 DESC2 00000003 00000002
00003456 DESC3 00000004 00000002
00004567 ERROR1 ERROR DESC1 00000001 00000003
00004567 DESC2 00000002 00000003
00004567 DESC3 00000003 00000003
00001234 TEST1 TESTER1 00000001 00000004
00001234 EXAMPLE1 00000002 00000004
00003456 TYPE2 TESTER2 00000001 00000005
00003456 EXAMPLE2 00000002 00000005
00004567 ERROR1 DESC LINE1 00000001 00000006
00004567 DESC LINE2 00000002 00000006
00001234 TEST1 TESTSAMP 00000001 00000007
00001234 SAMPLE1 00000002 00000007
00001234 DESCRIPTION 00000002 00000001
00001234 TESTDUPL 00000003 00000001
00003456 TYPE2 TESTER2 00000001 00000002
00003456 DESC1 00000002 00000002
00003456 DESC2 00000003 00000002
00003456 DESC3 00000004 00000002
00004567 ERROR1 ERROR DESC1 00000001 00000003
00004567 DESC2 00000002 00000003
00004567 DESC3 00000003 00000003
00001234 TEST1 TESTER1 00000001 00000004
00001234 EXAMPLE1 00000002 00000004
00003456 TYPE2 TESTER2 00000001 00000005
00003456 EXAMPLE2 00000002 00000005
00004567 ERROR1 DESC LINE1 00000001 00000006
00004567 DESC LINE2 00000002 00000006
00001234 TEST1 TESTSAMP 00000001 00000007
00001234 SAMPLE1 00000002 00000007
The third scenario on outrec i got bit confused i used the same technique in grouping and moved the existing id to new positions but when i looked at the output file bot the id's of the files were similar.
Pasted below is the piece of code which i used in the third scenario.
Source code:-
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(41:SEQNUM,8,ZD,
RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,
BEGIN=(41,8,CH,EQ,C'00000001'),
PUSH=(50:ID=8))
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=GROUP,
BEGIN=(41,8,CH,EQ,C'00000001'),
PUSH=(60:ID=8,70:50,8))
OVERLAY=(41:SEQNUM,8,ZD,
RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,
BEGIN=(41,8,CH,EQ,C'00000001'),
PUSH=(50:ID=8))
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=GROUP,
BEGIN=(41,8,CH,EQ,C'00000001'),
PUSH=(60:ID=8,70:50,8))
Output:-
00001234 TEST1 TESTING 00000001 00000001 00000001 00000001
00001234 DESCRIPTION 00000002 00000001 00000001 00000001
00001234 TESTDUPL 00000003 00000001 00000001 00000001
00003456 TYPE2 TESTER2 00000001 00000002 00000002 00000002
00003456 DESC1 00000002 00000002 00000002 00000002
00003456 DESC2 00000003 00000002 00000002 00000002
00003456 DESC3 00000004 00000002 00000002 00000002
00004567 ERROR1 ERROR DESC1 00000001 00000003 00000003 00000003
00004567 DESC2 00000002 00000003 00000003 00000003
00004567 DESC3 00000003 00000003 00000003 00000003
00001234 TEST1 TESTER1 00000001 00000004 00000004 00000004
00001234 EXAMPLE1 00000002 00000004 00000004 00000004
00003456 TYPE2 TESTER2 00000001 00000005 00000005 00000005
00003456 EXAMPLE2 00000002 00000005 00000005 00000005
00004567 ERROR1 DESC LINE1 00000001 00000006 00000006 00000006
00004567 DESC LINE2 00000002 00000006 00000006 00000006
00001234 TEST1 TESTSAMP 00000001 00000007 00000007 00000007
00001234 SAMPLE1 00000002 00000007 00000007 00000007
00001234 DESCRIPTION 00000002 00000001 00000001 00000001
00001234 TESTDUPL 00000003 00000001 00000001 00000001
00003456 TYPE2 TESTER2 00000001 00000002 00000002 00000002
00003456 DESC1 00000002 00000002 00000002 00000002
00003456 DESC2 00000003 00000002 00000002 00000002
00003456 DESC3 00000004 00000002 00000002 00000002
00004567 ERROR1 ERROR DESC1 00000001 00000003 00000003 00000003
00004567 DESC2 00000002 00000003 00000003 00000003
00004567 DESC3 00000003 00000003 00000003 00000003
00001234 TEST1 TESTER1 00000001 00000004 00000004 00000004
00001234 EXAMPLE1 00000002 00000004 00000004 00000004
00003456 TYPE2 TESTER2 00000001 00000005 00000005 00000005
00003456 EXAMPLE2 00000002 00000005 00000005 00000005
00004567 ERROR1 DESC LINE1 00000001 00000006 00000006 00000006
00004567 DESC LINE2 00000002 00000006 00000006 00000006
00001234 TEST1 TESTSAMP 00000001 00000007 00000007 00000007
00001234 SAMPLE1 00000002 00000007 00000007 00000007
I am not sure if i did code it exactly. Sorry for troubling you a lot.
Request you to kindly help me in achieving the same.
Thanks in advance!!!