View previous topic :: View next topic
|
Author |
Message |
shankarparab80
New User
Joined: 22 Mar 2012 Posts: 4 Location: Pune
|
|
|
|
Hi,
I have a requirement to reformat the following input file into the required format.
The format of input file is as follows,
Code: |
Level Pgm-Name
01 AAAAAAAA
02 BBBBBBBB
02 CCCCCCC
02 DDDDDDD
01 XXXXXXXX
02 YYYYYYYYY
02 ZZZZZZZZ |
The 01 level program is calling programs in level-2. The input file will have the 01 level program name following by its calling programs in Level 02.
Hence I want the output in following format,
Code: |
Level 1 Level 2
AAAAAAAA BBBBBBBB
AAAAAAAA CCCCCCC
AAAAAAAA DDDDDDD
XXXXXXXX YYYYYYYYY
XXXXXXXX YYYYYYYYY |
Can this be done using SORT?
Best Regards,
Shankar Parab |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, it is possible. With GROUP, for instance.
Please show your data in the Code tags next time, which preserves the spacing.
Presumably you input and output are FB?
Are you going to try this yourself? I think you should find some useful examples if you search the DFSORT forum where you have posted.
Posting your DFSORT level would be useful. There is a Sticky in the forum telling you how to find it. |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi,
Use below mentioned sort card.
Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01 AAAAAAAA
02 BBBBBBBB
02 CCCCCCC
02 DDDDDDD
01 XXXXXXXX
02 YYYYYYYYY
02 ZZZZZZZZ
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'01'),
PUSH=(81:4,8))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,2,CH,EQ,C'02'),
BUILD=(1:81,8,9:3,20,80:X)
/*
|
Output:
Code: |
AAAAAAAA BBBBBBBB
AAAAAAAA CCCCCCC
AAAAAAAA DDDDDDD
XXXXXXXX YYYYYYYYY
XXXXXXXX ZZZZZZZZ |
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I'm assuming this is a TYPO
Code: |
Level 1 Level 2
AAAAAAAA BBBBBBBB
AAAAAAAA CCCCCCC
AAAAAAAA DDDDDDD
XXXXXXXX YYYYYYYYY
XXXXXXXX YYYYYYYYY |
The last line should be
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Alternatively, you could use these DFSORT statements:
Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(1:7,10,12:7,10,81:2,1)),
IFTHEN=(WHEN=GROUP,BEGIN=(81,1,CH,EQ,C'1'),
PUSH=(1:1,10))
OPTION COPY
OUTFIL INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
|
|
|
Back to top |
|
|
shankarparab80
New User
Joined: 22 Mar 2012 Posts: 4 Location: Pune
|
|
|
|
Hi all,
Thanks a lot for your help.
The solution is working fine.
Best Regards,
Shankar Parab |
|
Back to top |
|
|
|
|