View previous topic :: View next topic
|
Author |
Message |
sudib19
New User
Joined: 06 Feb 2007 Posts: 29 Location: Noida
|
|
|
|
Hi,
I have a file of 49 bytes, it has a header, detail record and trailer. I want to put in 00 in the 20th bytes and copy rest of the data to a new file, I also want to keep the header and trailer as it is.
Code: |
----+----1----+----2----+----3----+----4----+----
********************************* Top of Data ***
0SL122012
1211740 20425173021108857923091822794830450372
900001
|
My file should look like
Code: |
----+----1----+----2----+----3----+----4----+----
********************************* Top of Data ***
0SL122012
1211740 2042517302001108857923091822794830450372
900001
|
I have tried using DATASORT but that does not allow OUTFIL OUTREC or BUILD. I have the TOOLIN data as
Code: |
//TOOLIN DD *
MODE STOP
DATASORT FROM(I1) TO(O1) HEADER(1) TRAILER(1) USING(CTL1)
//CTL1CNTL DD *
OUTFIL BUILD=(1:1,19,20:C'00',22:20,28) |
But it gives me an error
Code: |
DATASORT FROM(I1) TO(O1) HEADER(1) TRAILER(1) USING(CTL1)
SORT FUNCTION IS REQUIRED FOR DATASORT OPERATION
OPERATION RETURN CODE: 12
|
Please let me know how to resolve it.
Thanks
Sudib19 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Do you want the data sorted?
Code: |
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
OVERLAY=(20:C'00')) |
|
|
Back to top |
|
|
sudib19
New User
Joined: 06 Feb 2007 Posts: 29 Location: Noida
|
|
|
|
Thanks for your post Bill
No I do not need the data to be sorted.
The data in position 20 can be anything.
I would need 00 to be added to the 20th position. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
sudib19 wrote: |
Thanks for your post Bill
No I do not need the data to be sorted.
The data in position 20 can be anything.
I would need 00 to be added to the 20th position. |
sudib19,
why are using DATASORT when you don't need the data to be sorted? It is a simple COPY step. Use the control cards shown by Bill but use a COPY operator. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
sudib19 wrote: |
Thanks for your post Bill
No I do not need the data to be sorted.
The data in position 20 can be anything.
I would need 00 to be added to the 20th position. |
That is to say, you wish the characters "00" inserted at the 20th position, with the data in positions 21-47 shifted to the right. The input data set is generated by a program written by someone who knew what was doing, so positions 47-49 are guaranteed to be spaces, hex zeroes, or other "don't care" values, right? |
|
Back to top |
|
|
sudib19
New User
Joined: 06 Feb 2007 Posts: 29 Location: Noida
|
|
|
|
Thanks all for your help. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
DATASORT is for sorting the data whilst leaving any headers or trailer which you identify to it in their original relative positions on the file.
DATASORT requires a SORT statement, which will be applied to all records not identified as headers or trailers.
It is not just a way to exclude headers and trailers from your processing.
Due to the 0, 1 or 9 in the first position of each record, it is easy for you to identify the data records, and to only change those, with the simple IFTHEN=(WHEN=(logicalexpresion shown to you with the OVERLAY to change the data positions to the value you require. |
|
Back to top |
|
|
|