Page 1 of 1
splitting of records using cobol
Posted: Tue Jun 24, 2014 1:22 pm
I have following input file:
record length is fixed to 80
I need the following output file:
here record length has to be 80
i.e. i need the data between any two | as one record of 80 length with padding
Posted: Tue Jun 24, 2014 2:09 pm
Have a look at UNSTRING and see if you'd find it useful.
Posted: Tue Jun 24, 2014 8:12 pm
Thanks willam , had look into it, but if u see the 2 nd and 3 rd line of my input ddd is split into 2 lines if we use unstring it come as separate lines is there any way to concatenate these both
Posted: Tue Jun 24, 2014 8:50 pm
Can you show the code you used, the input you used, the output you received and the output you expected, please?
All inside the Code tags to preserve spacing.
Posted: Wed Jun 25, 2014 3:40 pm
Inspect the UNSTRING data(only for first character). if matches then STRING those data.
UNSTRING Record delimited by '|'
into WS-var1 WS-var2 WS-var3 WS-var4......
If WS-var2(1:1) = WS-var3(1:1)
String WS-var2 DELIMITED BY SIZE
WS-var2DELIMITED BY SIZE
Posted: Wed Jun 25, 2014 6:45 pm
You need to re-think that considerably. Why would ( 1 : 1 ) of anything be equal to ( 1 : 1 ) of anything else? If you delimit by SIZE, you'll get trailing blanks. You'd also need to set all those fields to space first, else you'll get values "left over" from the previous UNSTRING if there are more pipes on the previous than on the current.
Posted: Wed Jun 25, 2014 8:21 pm
Will, I got your point....so we need exact INPUT data because I thought after 3d there is one | .
gkrish- You need to paste Exact INPUT and desired OUTPUT.