|
View previous topic :: View next topic
|
| Author |
Message |
ppandey07
New User
Joined: 27 Nov 2008 Posts: 51 Location: Delhi, India
|
|
|
|
I have a variable block file having records as:
${1:F01NWBKGBCEAXXX4339285235}
{2:O0812301100510ABMOXXXXGXXX00002205371005110616S}
{4:
{202:0001}
{203:0001}
{305:A}
{331:433710051006151005101748000
{331:433810051017501005101920000
{332:000332000016}
{305:B}
{331:278510051006151005101749000
{331:278610051017501005101920000
{332:000325000413}
{305:C}
{332:000000000000}
{305:D}
{332:000000000000}}
{5:
{CHK:23FE841BCEAC}
{SYS:}}
${1:F01NWBKGBCEAXXX4339285243}
$ marks the beginning of a record. Now because of the volume, I want to split the file into multiple files. Condition we have is:
First 'x' no. of records to 1st file, followed by 'y' no. of records to 2nd file and remaining to 3rd file
How do we logically break the file into different files so that the records (separated by '$') remain intact. |
|
| Back to top |
|
 |
smijoss
Active User
Joined: 30 Aug 2007 Posts: 114 Location: pune
|
|
|
|
Assuming u need to move 500 data records to first 2 files and remaining to third file
| Code: |
OPTION COPY
INREC BUILD=(1,4,8X,5)
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(13,1,CH,EQ,C'$'),PUSH=(5:ID=8))
OUTFIL FNAMES=FILE1,INCLUDE=(5,8,ZD,LE,500),BUILD=(1,4,13)
OUTFIL FNAMES=FILE2,INCLUDE=(5,8,ZD,GT,500,AND,5,8,ZD,LE,1000),BUILD=(1,4,13)
OUTFIL FNAMES=FILE3,SAVE,BUILD=(1,4,13)
|
but i would like to know if the PUSH could have been to INREC so that i dont need to use INREC and OUTREC together ? |
|
| Back to top |
|
 |
smijoss
Active User
Joined: 30 Aug 2007 Posts: 114 Location: pune
|
|
|
|
you can remove the inrec part as follows
| Code: |
OPTION COPY
OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,5)),
IFTHEN=(WHEN=GROUP,BEGIN=(13,1,CH,EQ,C'$'),PUSH=(5:ID=8))
OUTFIL FNAMES=FILE1,INCLUDE=(5,8,ZD,LE,500),BUILD=(1,4,13)
OUTFIL FNAMES=FILE2,INCLUDE=(5,8,ZD,GT,500,AND,5,8,ZD,LE,1000),BUILD=(1,4,13)
OUTFIL FNAMES=FILE3,SAVE,BUILD=(1,4,13) |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Pankaj,
It isn't clear to me what you want to do or if the posted solution will do it.
What is the RECFM and LRECL of your input file?
You talk about a "record" starting with $ - do you mean a group of records? Do you want to move each group of records to a different file?
How does "First 'x' no. of records to 1st file, etc" relate to the groups of records? Do you really mean "first group of records, starting with $, to 1st file, etc"?
Please show an example of the records in your input file (more than one set) and what you expect for the output files. Explain the rules for getting from input to output.
In the future, please spend the time to describe what you want to do more clearly with good examples. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|