Posted: Tue Sep 18, 2018 2:44 am Post subject: DFSORT - subgrouping
Hi,
I'm trying to convert a program written with an obsolete language into a sort.
This program read a file (LREL=120, FB) and reformat it with the following rules:
1. If record type (position=2, length=2) is LESS than "10" and NOT EQUAL "EF" write output unchanged (same of input)
2. If record type (position=2, length=2) is GREATER OR EQUAL "10" (it starts a subgroup) write ouput with changing position 4,7 with number of subgroup (see below)
3. If record type (position=2, length=2) is EQUAL "EF" (it closes a GROUP) write output with changing position 46,7 with total of subgroups of group.
When record type is "EF" the subgroups counter must be reset, so every record "EF" will have at position 46,7 the number of subgroups that compose it.
Input example:
Code:
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
10 a Rec.000003 On output pos.4,7 must have 0000001 << Subgroup
20 a Rec.000004 On output pos.4,7 must have 0000001 << Subgroup
30 a Rec.000005 On output pos.4,7 must have 0000001 << Subgroup
10 b Rec.000006 On output pos.4,7 must have 0000002 << Subgroup
20 b Rec.000007 On output pos.4,7 must have 0000002 << Subgroup
30 b Rec.000008 On output pos.4,7 must have 0000002 << Subgroup
10 c Rec.000009 On output pos.4,7 must have 0000003 << Subgroup
20 c Rec.000010 On output pos.4,7 must have 0000003 << Subgroup
30 c Rec.000011 On output pos.4,7 must have 0000003 << Subgroup
EF G1 Rec.000012 End GROUP1 >SubGroups>NNNNNNN< Had to be 0000003
10 c Rec.000013 On output pos.4,7 must have 0000001 << Subgroup
20 c Rec.000014 On output pos.4,7 must have 0000001 << Subgroup
30 c Rec.000015 On output pos.4,7 must have 0000001 << Subgroup
10 d Rec.000016 On output pos.4,7 must have 0000002 << Subgroup
20 d Rec.000017 On output pos.4,7 must have 0000002 << Subgroup
30 d Rec.000018 On output pos.4,7 must have 0000002 << Subgroup
10 e Rec.000019 On output pos.4,7 must have 0000003 << Subgroup
20 e Rec.000020 On output pos.4,7 must have 0000003 << Subgroup
30 e Rec.000021 On output pos.4,7 must have 0000003 << Subgroup
10 f Rec.000022 On output pos.4,7 must have 0000004 << Subgroup
20 f Rec.000023 On output pos.4,7 must have 0000004 << Subgroup
30 f Rec.000024 On output pos.4,7 must have 0000004 << Subgroup
EF G2 Rec.000025 End GROUP2 >SubGroups>NNNNNNN< Had to be 0000004
EF G3 Rec.000026 End GROUP3 >SubGroups>NNNNNNN< Had to be 0000000
Output expected:
Code:
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
100000001Rec.000003 On output pos.4,7 must have 0000001 << Subgroup
200000001Rec.000004 On output pos.4,7 must have 0000001 << Subgroup
300000001Rec.000005 On output pos.4,7 must have 0000001 << Subgroup
100000002Rec.000006 On output pos.4,7 must have 0000002 << Subgroup
200000002Rec.000007 On output pos.4,7 must have 0000002 << Subgroup
300000002Rec.000008 On output pos.4,7 must have 0000002 << Subgroup
100000003Rec.000009 On output pos.4,7 must have 0000003 << Subgroup
200000003Rec.000010 On output pos.4,7 must have 0000003 << Subgroup
300000003Rec.000011 On output pos.4,7 must have 0000003 << Subgroup
EF G1 Rec.000012 End GROUP1 >SubGroups>0000003< Had to be 0000003
100000001Rec.000013 On output pos.4,7 must have 0000001 << Subgroup
200000001Rec.000014 On output pos.4,7 must have 0000001 << Subgroup
300000001Rec.000015 On output pos.4,7 must have 0000001 << Subgroup
100000002Rec.000016 On output pos.4,7 must have 0000002 << Subgroup
200000002Rec.000017 On output pos.4,7 must have 0000002 << Subgroup
300000002Rec.000018 On output pos.4,7 must have 0000002 << Subgroup
100000003Rec.000019 On output pos.4,7 must have 0000003 << Subgroup
200000003Rec.000020 On output pos.4,7 must have 0000003 << Subgroup
300000003Rec.000021 On output pos.4,7 must have 0000003 << Subgroup
100000004Rec.000022 On output pos.4,7 must have 0000004 << Subgroup
200000004Rec.000023 On output pos.4,7 must have 0000004 << Subgroup
300000004Rec.000024 On output pos.4,7 must have 0000004 << Subgroup
EF G2 Rec.000025 End GROUP2 >SubGroups>0000004< Had to be 0000004
EF G3 Rec.000026 End GROUP3 >SubGroups>0000000< Had to be 0000000
I tried many solution and read many post and manuals (by Frank Yaeger ), but I can not find a solution.
I suspect need use ICETOOL (which I do not know well) or maybe two step of sort.
This is my sort (one of my many tests) which obviously does not work as expected:
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Sep 18, 2018 11:42 am Post subject: Re: DFSORT - subgrouping
fspino wrote:
3. If record type (position=2, length=2) is EQUAL "EF" (it closes a GROUP) write output with changing position 46,7 with total of subgroups of group.
I tried many solution and read many post and manuals (by Frank Yaeger ), but I can not find a solution.
I suspect need use ICETOOL (which I do not know well) or maybe two step of sort.
Fspino,
You haven't shown what needs to be summarized for the group end record. So I did not show that piece of code. But it is easy to add
You don't need 2 passes of data. It is quite simple.
Brief description of the job.
Using INREC when=group we tag the records with a 7 byte ID at position 121 for the records that start with '10' in position 1,2. Also we sequence the EF records too on the same INREC
Now using that EF sequence number we push 7 byte ID at 121 on to position 137. This is done to reset the group number after the end of EF record. Since EF record already had an ID number from the '10' record when=group, pushing this number on to next set of 10 records will have the last Seqnum number. Now it is matter of simple subtraction of these 2 numbers. For a better understanding of this piece of code, I suggest you running INREC and OUTREC removing the IFOUTLEN parm, so that you can see the contents of how we are subtracting the values.
With OUTREC we took care of the 10 record group, but we still need to fix the EF record. So we take care of that on OUTFIL. Once we have all the sequence numbering , we simply replace the sequence numbers on to position 4.
Here is a DFSORT JCL that will give you the desired results.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00XXXXXXXREC.000001 MUST REMAIN UNALTERED, SO ANY REC. LT 10
01XXXXXXXREC.000002 MUST REMAIN UNALTERED, SO ANY REC. LT 10
10 A REC.000003 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 A REC.000004 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 A REC.000005 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 B REC.000006 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 B REC.000007 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 B REC.000008 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 C REC.000009 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 C REC.000010 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 C REC.000011 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
EF G1 REC.000012 END GROUP1 >SUBGROUPS>NNNNNNN< HAD TO BE 0000003
10 C REC.000013 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 C REC.000014 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 C REC.000015 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 D REC.000016 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 D REC.000017 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 D REC.000018 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 E REC.000019 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 E REC.000020 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 E REC.000021 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
10 F REC.000022 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
20 F REC.000023 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
30 F REC.000024 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
EF G2 REC.000025 END GROUP2 >SUBGROUPS>NNNNNNN< HAD TO BE 0000004
EF G3 REC.000026 END GROUP3 >SUBGROUPS>NNNNNNN< HAD TO BE 0000000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'10'),
PUSH=(121:ID=7)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'EF'),
OVERLAY=(129:SEQNUM,7,ZD))
00XXXXXXXREC.000001 MUST REMAIN UNALTERED, SO ANY REC. LT 10
01XXXXXXXREC.000002 MUST REMAIN UNALTERED, SO ANY REC. LT 10
10 0000001EC.000003 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 0000001EC.000004 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 0000001EC.000005 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 0000002EC.000006 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 0000002EC.000007 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 0000002EC.000008 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 0000003EC.000009 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 0000003EC.000010 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 0000003EC.000011 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
EF 0000003EC.000012 END GROUP1 >SUBGROUPS>NNNNNNN< HAD TO BE 0000003
10 0000001EC.000013 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 0000001EC.000014 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 0000001EC.000015 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 0000002EC.000016 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 0000002EC.000017 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 0000002EC.000018 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 0000003EC.000019 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 0000003EC.000020 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 0000003EC.000021 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
10 0000004EC.000022 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
20 0000004EC.000023 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
30 0000004EC.000024 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
EF 0000004EC.000025 END GROUP2 >SUBGROUPS>NNNNNNN< HAD TO BE 0000004
EF 0000000EC.000026 END GROUP3 >SUBGROUPS>NNNNNNN< HAD TO BE 0000000
You haven't shown what needs to be summarized for the group end record. So I did not show that piece of code. But it is easy to add
The record "EF" (that close each group) must be written overwriting the present at position 46 with the total number of subgroups of which its group is composed.
So the output does not have to be like this:
Code:
00XXXXXXXREC.000001 MUST REMAIN UNALTERED, SO ANY REC. LT 10
01XXXXXXXREC.000002 MUST REMAIN UNALTERED, SO ANY REC. LT 10
10 0000001EC.000003 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 0000001EC.000004 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 0000001EC.000005 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 0000002EC.000006 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 0000002EC.000007 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 0000002EC.000008 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 0000003EC.000009 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 0000003EC.000010 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 0000003EC.000011 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
EF 0000003EC.000012 END GROUP1 >SUBGROUPS>NNNNNNN< HAD TO BE 0000003
10 0000001EC.000013 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 0000001EC.000014 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 0000001EC.000015 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 0000002EC.000016 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 0000002EC.000017 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 0000002EC.000018 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 0000003EC.000019 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 0000003EC.000020 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 0000003EC.000021 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
10 0000004EC.000022 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
20 0000004EC.000023 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
30 0000004EC.000024 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
EF 0000004EC.000025 END GROUP2 >SUBGROUPS>NNNNNNN< HAD TO BE 0000004
EF 0000000EC.000026 END GROUP3 >SUBGROUPS>NNNNNNN< HAD TO BE 0000000
Instead it must be like this:
Code:
00XXXXXXXREC.000001 MUST REMAIN UNALTERED, SO ANY REC. LT 10
01XXXXXXXREC.000002 MUST REMAIN UNALTERED, SO ANY REC. LT 10
10 0000001EC.000003 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 0000001EC.000004 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 0000001EC.000005 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 0000002EC.000006 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 0000002EC.000007 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 0000002EC.000008 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 0000003EC.000009 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 0000003EC.000010 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 0000003EC.000011 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
EF G1 Rec.000012 End GROUP1 >SubGroups>0000003< Had to be 0000003
10 0000001EC.000013 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
20 0000001EC.000014 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
30 0000001EC.000015 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
10 0000002EC.000016 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
20 0000002EC.000017 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
30 0000002EC.000018 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
10 0000003EC.000019 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
20 0000003EC.000020 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
30 0000003EC.000021 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
10 0000004EC.000022 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
20 0000004EC.000023 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
30 0000004EC.000024 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
EF G2 Rec.000025 End GROUP2 >SubGroups>0000004< Had to be 0000004
EF G3 Rec.000026 End GROUP3 >SubGroups>0000000< Had to be 0000000
Please note that before the record type at position 2 (00, 01, 10, 20, 30, EF, ...) there is a space, so the position of BEGIN had to be 2,2.
Now I have to go to a meeting that will also last for the whole day tomorrow, but on Thursday I will check well your code to adapt it to my needs.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Sep 18, 2018 2:41 pm Post subject:
fspino wrote:
kolusu,
First of all, thank you for your reply
I didn't understand your phrase:
kolusu wrote:
You haven't shown what needs to be summarized for the group end record. So I did not show that piece of code. But it is easy to add
The record "EF" (that close each group) must be written overwriting the present at position 46 with the total number of subgroups of which its group is composed.
fspino,
In your earlier post
fspino wrote:
3. If record type (position=2, length=2) is EQUAL "EF" (it closes a GROUP) write output with changing position 46,7 with total of subgroups of group.
Total of sub groups would mean 1+2+3 = 6 but I wasn't sure if that is the case or you wanted total number of groups within each group.
fspino wrote:
Please note that before the record type at position 2 (00, 01, 10, 20, 30, EF, ...) there is a space, so the position of BEGIN had to be 2,2.
So the output does not have to be like this:
Now that I know what you want, here are the updated control cards considering the updated position of the indicators.
00XXXXXXXREC.000001 MUST REMAIN UNALTERED, SO ANY REC. LT 10
01XXXXXXXREC.000002 MUST REMAIN UNALTERED, SO ANY REC. LT 10
100000001REC.000003 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
200000001REC.000004 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
300000001REC.000005 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
100000002REC.000006 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
200000002REC.000007 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
300000002REC.000008 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
100000003REC.000009 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
200000003REC.000010 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
300000003REC.000011 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
EF G1 REC.000012 END GROUP1 >SUBGROUPS>0000003< HAD TO BE 0000003
100000001REC.000013 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
200000001REC.000014 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
300000001REC.000015 ON OUTPUT POS.4,7 MUST HAVE 0000001 << SUBGROUP
100000002REC.000016 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
200000002REC.000017 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
300000002REC.000018 ON OUTPUT POS.4,7 MUST HAVE 0000002 << SUBGROUP
100000003REC.000019 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
200000003REC.000020 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
300000003REC.000021 ON OUTPUT POS.4,7 MUST HAVE 0000003 << SUBGROUP
100000004REC.000022 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
200000004REC.000023 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
300000004REC.000024 ON OUTPUT POS.4,7 MUST HAVE 0000004 << SUBGROUP
EF G2 REC.000025 END GROUP2 >SUBGROUPS>0000004< HAD TO BE 0000004
EF G3 REC.000026 END GROUP3 >SUBGROUPS>0000000< HAD TO BE 0000000
And forgive me if my English is not so good. With:
fspino wrote:
3. If record type (position=2, length=2) is EQUAL "EF" (it closes a GROUP) write output with changing position 46,7 with total of subgroups of group.
I meant to say "3. If record type (position=2, length=2) is EQUAL "EF" (it closes a GROUP) write output with changing position 46,7 with the number of subgroups of that group. Then first group had 3 subgroups and so on."
Tomorrow morning I will study your code to understand where I was wrong (donkey I am! ). On the contrary! It's better if I do it right away and even tomorrow morning.
Thank you again and again and again for your solution.
You will have spaces at position 129 when you have an EF record without any gropus( ex the last EF record in your sample data) that start with 10. Since you wanted zeros I had to use UFF (unsigned free format) which would convert the spaces to zeros. _________________ Kolusu
www.linkedin.com/in/kolusu
Because it is possible that within input file (in the middle) there are other record with type (p.02,02) less than "10". Example:
Code:
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
10 a Rec.000003 On output pos.4,7 must have 0000001 << Subgroup
20 a Rec.000004 On output pos.4,7 must have 0000001 << Subgroup
30 a Rec.000005 On output pos.4,7 must have 0000001 << Subgroup
10 b Rec.000006 On output pos.4,7 must have 0000002 << Subgroup
20 b Rec.000007 On output pos.4,7 must have 0000002 << Subgroup
30 b Rec.000008 On output pos.4,7 must have 0000002 << Subgroup
10 c Rec.000009 On output pos.4,7 must have 0000003 << Subgroup
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
20 c Rec.000010 On output pos.4,7 must have 0000003 << Subgroup
30 c Rec.000011 On output pos.4,7 must have 0000003 << Subgroup
EF G1 Rec.000012 End GROUP1 >SubGroups>NNNNNNN< Had to be 0000003
10 c Rec.000013 On output pos.4,7 must have 0000001 << Subgroup
20 c Rec.000014 On output pos.4,7 must have 0000001 << Subgroup
30 c Rec.000015 On output pos.4,7 must have 0000001 << Subgroup
10 d Rec.000016 On output pos.4,7 must have 0000002 << Subgroup
20 d Rec.000017 On output pos.4,7 must have 0000002 << Subgroup
30 d Rec.000018 On output pos.4,7 must have 0000002 << Subgroup
10 e Rec.000019 On output pos.4,7 must have 0000003 << Subgroup
20 e Rec.000020 On output pos.4,7 must have 0000003 << Subgroup
30 e Rec.000021 On output pos.4,7 must have 0000003 << Subgroup
10 f Rec.000022 On output pos.4,7 must have 0000004 << Subgroup
20 f Rec.000023 On output pos.4,7 must have 0000004 << Subgroup
30 f Rec.000024 On output pos.4,7 must have 0000004 << Subgroup
EF G2 Rec.000025 End GROUP2 >SubGroups>NNNNNNN< Had to be 0000004
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
EF G3 Rec.000026 End GROUP3 >SubGroups>NNNNNNN< Had to be 0000000
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
With your solution the output was:
Code:
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
100000001Rec.000003 On output pos.4,7 must have 0000001 << Subgroup
200000001Rec.000004 On output pos.4,7 must have 0000001 << Subgroup
300000001Rec.000005 On output pos.4,7 must have 0000001 << Subgroup
100000002Rec.000006 On output pos.4,7 must have 0000002 << Subgroup
200000002Rec.000007 On output pos.4,7 must have 0000002 << Subgroup
300000002Rec.000008 On output pos.4,7 must have 0000002 << Subgroup
100000003Rec.000009 On output pos.4,7 must have 0000003 << Subgroup
000000003Rec.000001 Must remain unaltered, so any rec. LT 10
200000003Rec.000010 On output pos.4,7 must have 0000003 << Subgroup
300000003Rec.000011 On output pos.4,7 must have 0000003 << Subgroup
EF G1 Rec.000012 End GROUP1 >SubGroups>0000003< Had to be 0000003
100000001Rec.000013 On output pos.4,7 must have 0000001 << Subgroup
200000001Rec.000014 On output pos.4,7 must have 0000001 << Subgroup
300000001Rec.000015 On output pos.4,7 must have 0000001 << Subgroup
100000002Rec.000016 On output pos.4,7 must have 0000002 << Subgroup
200000002Rec.000017 On output pos.4,7 must have 0000002 << Subgroup
300000002Rec.000018 On output pos.4,7 must have 0000002 << Subgroup
100000003Rec.000019 On output pos.4,7 must have 0000003 << Subgroup
200000003Rec.000020 On output pos.4,7 must have 0000003 << Subgroup
300000003Rec.000021 On output pos.4,7 must have 0000003 << Subgroup
100000004Rec.000022 On output pos.4,7 must have 0000004 << Subgroup
200000004Rec.000023 On output pos.4,7 must have 0000004 << Subgroup
300000004Rec.000024 On output pos.4,7 must have 0000004 << Subgroup
EF G2 Rec.000025 End GROUP2 >SubGroups>0000004< Had to be 0000004
000000000Rec.000001 Must remain unaltered, so any rec. LT 10
010000000Rec.000002 Must remain unaltered, so any rec. LT 10
EF G3 Rec.000026 End GROUP3 >SubGroups>0000000< Had to be 0000000
000000000Rec.000001 Must remain unaltered, so any rec. LT 10
Instead of:
Code:
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
100000001Rec.000003 On output pos.4,7 must have 0000001 << Subgroup
200000001Rec.000004 On output pos.4,7 must have 0000001 << Subgroup
300000001Rec.000005 On output pos.4,7 must have 0000001 << Subgroup
100000002Rec.000006 On output pos.4,7 must have 0000002 << Subgroup
200000002Rec.000007 On output pos.4,7 must have 0000002 << Subgroup
300000002Rec.000008 On output pos.4,7 must have 0000002 << Subgroup
100000003Rec.000009 On output pos.4,7 must have 0000003 << Subgroup
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
200000003Rec.000010 On output pos.4,7 must have 0000003 << Subgroup
300000003Rec.000011 On output pos.4,7 must have 0000003 << Subgroup
EF G1 Rec.000012 End GROUP1 >SubGroups>0000003< Had to be 0000003
100000001Rec.000013 On output pos.4,7 must have 0000001 << Subgroup
200000001Rec.000014 On output pos.4,7 must have 0000001 << Subgroup
300000001Rec.000015 On output pos.4,7 must have 0000001 << Subgroup
100000002Rec.000016 On output pos.4,7 must have 0000002 << Subgroup
200000002Rec.000017 On output pos.4,7 must have 0000002 << Subgroup
300000002Rec.000018 On output pos.4,7 must have 0000002 << Subgroup
100000003Rec.000019 On output pos.4,7 must have 0000003 << Subgroup
200000003Rec.000020 On output pos.4,7 must have 0000003 << Subgroup
300000003Rec.000021 On output pos.4,7 must have 0000003 << Subgroup
100000004Rec.000022 On output pos.4,7 must have 0000004 << Subgroup
200000004Rec.000023 On output pos.4,7 must have 0000004 << Subgroup
300000004Rec.000024 On output pos.4,7 must have 0000004 << Subgroup
EF G2 Rec.000025 End GROUP2 >SubGroups>0000004< Had to be 0000004
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
01xxxxxxxRec.000002 Must remain unaltered, so any rec. LT 10
EF G3 Rec.000026 End GROUP3 >SubGroups>0000000< Had to be 0000000
00xxxxxxxRec.000001 Must remain unaltered, so any rec. LT 10
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Sep 20, 2018 11:01 am Post subject:
fspino wrote:
kolusu",
Thanks for the explanation.
I had to add a command to your solution
Because it is possible that within input file (in the middle) there are other record with type (p.02,02) less than "10".
Maybe it's not a fine solution, but it works.
Any way, thanks a lot again.
Francesco
fspino,
First things first. Please have all your requirements stated upfront. we can only interpret your posts as we cannot look at your data.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Sep 21, 2018 10:51 am Post subject:
fspino,
What I meant by the statement "First things first. Please have all your requirements stated upfront. we can only interpret your posts as we cannot look at your data." is that I wasn't expecting 00 records in between the groups. And that is the reason I mentioned that we cannot look at the data.
fspino wrote:
Any way, which differences there are between my and your solution? On running, I mean. These line was added on OUTFIL of mine:
Execution wise there is NOT much of a difference. However my order of preference is to have like items processed together. In the OUTREC I am processing the groups and 00 records are part of the group. Even though EF is part of the group, we have an additional processing for that which is done in OUTFIL
fspino wrote:
Moreover remember that "EF" is less than "10".
It does NOT matter, as EF record is getting the value from position 129 instead of position 121. So irrespective of it is lower or higher I am specially processing the EF records on OUTFIL, so they would get the new value.
A minor update to my control cards is that I would expand the search in the LAST IFTHEN to seven bytes instead of just 1 byte.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum