|
View previous topic :: View next topic
|
| Author |
Message |
sun_job
New User

Joined: 18 Sep 2007 Posts: 73 Location: Bangalore
|
|
|
|
Hi All,
Please find the file below
| Quote: |
COMPANY
00000001ACCOUNT
00000002ACCOUNT
00000003ACCOUNT
COMPANY
00000001ACCOUNT
00000002ACCOUNT |
The record which has 'COMPANY' word is header record, and the records below that are detail records. The output is needed in two files, such as the first header and its detail in one file and second header and its detail in second file.
Please help |
|
| Back to top |
|
 |
nelson.pandian
Active User
.jpg)
Joined: 09 Apr 2008 Posts: 133 Location: Phoenix, AZ
|
|
|
|
Hi Sun,
Your input file will have only 2 Company record?
What is the RECFM & LRECL of your INPUT/OUTPUT file? |
|
| Back to top |
|
 |
nelson.pandian
Active User
.jpg)
Joined: 09 Apr 2008 Posts: 133 Location: Phoenix, AZ
|
|
|
|
Hi Sun,
The below DFSORT JCL will give you desire output. Assumed your INPUT/OUTPUT LRECL=80 & RECFM=FB. JCL can be changed appropriately.
| Code: |
//STEP10 EXEC PGM=SORT
//*
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD *
COMPANY
00000001ACCOUNT
00000002ACCOUNT
00000003ACCOUNT
COMPANY
00000001ACCOUNT
00000002ACCOUNT
/*
//*
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//*
//SYSIN DD * *** CONSTANT CONTROL CARDS ***
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'COMPANY'),PUSH=(81:ID=1))
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)
/* |
If this is not what you want, Show us with a better example and rules to achieve it. |
|
| Back to top |
|
 |
sun_job
New User

Joined: 18 Sep 2007 Posts: 73 Location: Bangalore
|
|
|
|
yes, the input file will have only two company record
its a variable block file , LRECL = 1000 |
|
| Back to top |
|
 |
sun_job
New User

Joined: 18 Sep 2007 Posts: 73 Location: Bangalore
|
|
|
|
| Thanks a lot , Nelson . I appreciate your help. Its working. [/b] |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| sun_job wrote: |
yes, the input file will have only two company record
its a variable block file , LRECL = 1000 |
sun_job,
Do NOT use the same approach for VB file , appending an ID num at the end of a VB file will ruin the very basic concept of VB files. You will be making all the variable records of the same length.
Use the following DFSORT JCL which will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input VB file,DISP=SHR
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,X,5)),
IFTHEN=(WHEN=GROUP,BEGIN=(6,7,CH,EQ,C'COMPANY'),PUSH=(5:ID=1))
OUTFIL FNAMES=OUT1,INCLUDE=(5,1,ZD,EQ,1),BUILD=(1,4,6)
OUTFIL FNAMES=OUT2,INCLUDE=(5,1,ZD,EQ,2),BUILD=(1,4,6)
//* |
|
|
| Back to top |
|
 |
sun_job
New User

Joined: 18 Sep 2007 Posts: 73 Location: Bangalore
|
|
|
|
| Thanks a lot, Skolusu |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|