View previous topic :: View next topic
|
Author |
Message |
pranav yadav
New User
Joined: 04 Apr 2008 Posts: 9 Location: Noida, India
|
|
|
|
Hi,
I have a input as
Input Data:
228609200000919N246971500002349N569193100001226N763652000000919N
Now my requirement is that, when the character 'N' appears in the above input, then the next chunk of data should be printed into next line.
Desired Ouput:
228609200000919N
246971500002349N
569193100001226N
763652000000919N
Although I am able to do it by reading the file into an array and then writing it to the next line when the character 'N' appears.But this is increasing the execution time of the program.
I wonder if it can be done by SORT.
Please guide me, so that I can do this by Using SORT. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What is the RECFM and LRECL of the input file?
What is the maximum number of output records you expect?
Are the chunks of data always 16 bytes in your example? Or can they be different sizes? If so, please show a better example where the chunks are not always 16 bytes. |
|
Back to top |
|
|
pranav yadav
New User
Joined: 04 Apr 2008 Posts: 9 Location: Noida, India
|
|
|
|
Frank thanks for replying
The RECFM is FB, LRECL is 256 bytes.
Maximum no of output records is around 75000000, each of 16 bytes.
Yes the chunks of data are always of 16 bytes in my file.
Character 'N' appears always appears at the fixed positon, i.e, always after the first 15 characters.
I am getting excited to know the Sort card for this. I hope I will get one. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
So are you saying the N at the end really has no significance and you really just want to divide each 256 byte record into sixteen 16-byte records? If the N has significance, then you haven't actually explained what significance it has.
If you do want to divide each 256 byte record into 16-byte records, the easiest way to do that is with the new RESIZE operator of DFSORT's ICETOOL available with z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/256)
//OUT DD DSN=... output file (FB/16)
//TOOLIN DD *
RESIZE FROM(IN) TO(OUT) TOLEN(16)
/*
|
For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
If you don't have that PTF, then you can do it with a more complex DFSORT job like this:
Code: |
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/256)
//SORTOUT DD DSN=... output file (FB/16)
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(1,16,/,17,16,/,33,16,/,49,16,/,
...)
|
The / means start a new record. Just specify each 16-byte chunk. |
|
Back to top |
|
|
pranav yadav
New User
Joined: 04 Apr 2008 Posts: 9 Location: Noida, India
|
|
|
|
Thanks alot Frank for your help.
I was able to do the required processing with my file. |
|
Back to top |
|
|
|