Page 1 of 1

DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Tue Dec 15, 2015 7:38 pm
by tsdjim
Hi,

I have the following record, I need to move the BB6666 to the beginning of the record. I have given the positions. Also I need to edit all X'00' to a space.
How do I do this in ICETOL.

Before

Pos 5
00001000521 34567890047 BB6666 ...... rest of record....
After
Pos 5
BB6666 00001000521 34567890047 ....rest of record.....


Thanks

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Tue Dec 15, 2015 7:47 pm
by BillyBoyo
To change the binary-zeros to spaces, either look at ALTSEQ with TRAN=ALTSEQ or look at FINDREP.

A simple BUILD will allow you to rearrange your data. BUILD=(1,4,21,6,5,16,27) (I've not counted, so fix the positions, and I'm assuming variable-length records).

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Tue Dec 15, 2015 10:28 pm
by tsdjim
Thanks. I managed to build the following parameters (still need to try) ,but I have another question:

I edit only records that do not have a blank in position 10. However how do I write the other unmatching records unchanged. How can I do that.

OPTION COPY
ALTSEQ CODE=(0040)
OUTREC IFTHEN=(WHEN=(10,1,CH,NE,' '), -
BUILD=(1,4,31,5,6,30,32,100,TRAN=ALTSEQ))

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Tue Dec 15, 2015 10:33 pm
by BillyBoyo
With that code, any records which don't match the WHEN condition will be left unchanged.

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Tue Dec 15, 2015 11:04 pm
by tsdjim
In the BUILD the positions 32,100 are actually the rest of the record. Is there a way to specify the rest of the record till the end, without explicitly specifying the positions

OPTION COPY
ALTSEQ CODE=(0040)
OUTREC IFTHEN=(WHEN=(10,1,CH,NE,' '), -
BUILD=(1,4,31,5,6,30,rest unchanged,TRAN=ALTSEQ))

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Wed Dec 16, 2015 1:46 am
by BillyBoyo
For a variable-length record, yes, like my example (where the last start-position is "unpaired" by a length).

For a fixed-length record, no.

Re: DFSORT MOVE FIELDS EDIT RECORD WITH ALTSET

PostPosted: Wed Dec 16, 2015 7:08 pm
by tsdjim
I created the following statements and they work fine except for the ALTSEQ which is not taking effect, the X'00' is not translated to X'40' in the file. Any ideas
why it might not work.

OPTION COPY
OUTFILE FNAMES=(OUT)
ALTSEQ CODE=(0040)
OUTREC IFTHEN=(WHEN=(8,2,CH,EQ,C'00',AND,35,3,CH,NE,C' '),
BUILD=(1,4,5,1,35,4,3X,8,28,41,93,TRAN=ALTSEQ)),
IFTHEN=(WHEN=(8,2,CH,EQ,C'00',AND,35,3,CH,EQ,C' '),
BUILD=(1,4,5,1,1X,39,5,1X,8,28,3X,44,90,TRAN=ALTSEQ))

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Wed Dec 16, 2015 8:09 pm
by BillyBoyo
TRAN=ALTSEQ is a field-level thing, it operates on the immediately previous field-definition (in your case, 41,93 and 44,90).

You either specify it for any fields you have defined (as in start,length) or you can use FINDREP to find X'00' and replace it with C' '.

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Wed Dec 16, 2015 8:10 pm
by Terry Heinze
tsdjim,
In the future please use Code tags (available in POSTREPLY) to retain accurate spacing.

Re: DFSORT MOVE FIELDS EDIT RECORD

PostPosted: Fri Dec 18, 2015 11:39 am
by tsdjim
It worked fine now after changing the ALTSEQ at the field level. Thanks for all who helped.

Ron