Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yes, you can use DFSORT's INREC or OUTREC statement to do that.
If the VB input record looked like this (rrrr is the RDW):
rrrrAAAABBBB1111data
and you wanted the VB output record to look like this:
rrrrAAAA1111BBBBdata
you could use these DFSORT statements:
Code:
OPTION COPY
INREC BUILD=(1,8,9:13,4,13:9,4,17)
It isn't clear what positions your fields are actually in. If you need more specific help, please give the starting position and length of each field (COL-1, COL-2 and COL-3) and indicate whether or not there are other fields after those three.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You're getting the "wrong" answer because you're giving the "wrong" information. In all your previous posts, you said the input file has RECFM=VB. But based on your latest post where you use RECFM=FB for SORTOUT, and on the output you say you got with your INREC statement, it appears that your input file has RECFM=FB. Also, your previous descriptions of your fields do NOT match the data you are now showing.
Based on your latest post, this would be the DFSORT job you need:
I am trying to move first 2 bytes of data to 10-11 position similarly
data from 3-11 position data should be moved to first two bytes. and am
trying below sort card - not sure what mistake I made - it says OVERLAPPING has occured
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Code:
INREC BUILD=(12,82,1:9,2,3:1,9)
You got the overlapping message because you have overlapping fields. 12,82 copies input positions 12-93 to output positions 1-82. Then you have 1: which is less than 83 so you get the overlapping message.
Why are you using 12,82? Why are you using 9,2 and 1,9? Why are you using LRECL=82? None of this corresponds to what you said you want to do, and what you said you want to do doesn't make sense anyway.
The only thing that does make sense is your input/output record example. It shows that you want to move input positions 3-11 to output positions 1-9 and input positions 1-2 to output positions 10-11. To do that, you would use these DFSORT control statements:
Code:
OPTION COPY
INREC BUILD=(1:3,9,10:1,2)
This will give you an output LRECL of 11.
I don't know what your input LRECL is or whether you want to copy the remaining characters (12-?) to the output records. If, for example, your input file has LRECL=80 and you want to copy the remaing characters to the output records, you would use:
Input - FB 82
Output - FB 77
First 9 bytes are spaces. I want to cut the length from 82 to 77.
Instead of last 5 bytes, I want to eliminate first 5 bytes.
Current:
--------
1 2 3 4 5 6 7 8 9 10 11 ...... 82
<first 9 spaces> A A ...... A
Output:
-------
1 2 3 4 5 6 7 8 9 10 11 .......77
<4 sp> A A A A A A .......A