goldyroshan wrote:Anuj Dhawan wrote:Somehitng does not match up - why are you using this:
- mentioning this means, in the output at position 251, get the data from input starting from 251st postion and of length 0 -- which does not make sense and you get an error.
What length do you want for the output and what do you want to have at 251st position, a zero, or something from input?
@Anuj,
You are right, that is what even i figured out eventually. I was able to remove this error but I am not getting the desired output.
Basically I want to replicate the below logic into a SORT JCL (i.e. FILEAID needs to be replaced with SORT).
PS005 EXEC PGM=FILEAID,
DD01 DD DSN=i/p file,
FILE DD DSN=o/p file
SYSIN DD *
$$DD01 USER PADCHAR=C' ',
IF=(001,EQ,C'M'),
MOVE=(001,244,001),
MOVE=(245,C'XXXXXX'),
MOVE=(251,0,251),
WRITE=FILE,
IF=(001,NE,C'M'),
MOVE=(001,0,001),
WRITE=FILE
/*
Please help me with the sort card that I used above or maybe you could suggest some other way to achieve this. TIA!
@Anuj - I actually can't understand the significance of MOVE=(251,0,251),
in the previous snippet (AS-IS scenario using PGM=FILEAID) :-
$$DD01 USER PADCHAR=C' ',
IF=(001,EQ,C'M'),
MOVE=(001,244,001),
MOVE=(245,C'XXXXXX'),
MOVE=(251,0,251),
WRITE=FILE,
IF=(001,NE,C'M'),
MOVE=(001,0,001),
WRITE=FILE
Well, I tried using the following SORTCARD, it seems to be working. Let me know your thoughts on this:-
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'M'),
BUILD=(1:1,244,C'XXXXXX',251:251,750)),
IFTHEN=(WHEN=(1,1,CH,NE,C'M'),
BUILD=(1:1,1000))
N.B. : LRECL of output file is 1000