Apologies for not explaining the requirement clearly.
Let me try to explain the requirement.
I have a input file like this (this is a load ready file for a database)
123456789
I dont have a copybook that maps to this but this file gets loaded to a teradata table so i have declaration available for the table. Say here we have VAR1 (123) VAR2 (456) and VAR3 (789)
My end aim is to achieve this -
123|456|789
Now the problem is - for me to insert pipe i need to know the position where each variable ends, and that i have to extract from table declaration.
Here, 1 4 and 7 are starting position of each variable. So if i can extract this positions in one sort step, i can use these in next sort step to insert pipe in my original file.
I hope i am able to explain the requirement. Is there any better way to achieve this?
Note - i have multiple load ready files, so i need to keep this solution generic.
I am halfway and achieved first part of what i am looking for. Need help in the second part.
I am posting my requirement again to be more clear -
Main requirement - I have a input file (say IP1) and i want to create a pipe delimited output file (OP2).
Now i dont know the exact position where i need to insert the pipe, as i dont have a copybook layout, but i have another file (IP2) that has starting position of each variable with some more data in the file. So i can extract this in Output OP1.
So i need to divide the requirement like this -
1. Use IP2 file to get the starting position of each variable and save in OP1
2. Use OP1 and IP1 to create a pipe delimited output OP2
OPTION COPY
INCLUDE COND=(1,80,SS,EQ,C'.FIELD')
INREC IFTHEN=(WHEN=INIT,
PARSE=(%=(STARTAFT=C'.FIELD ',ENDAT=BLANKS,FIXLEN=80),
%01=(STARTAT=NUM,ENDBEFR=BLANKS,FIXLEN=5)),
BUILD=(%01,X))
END
Now i need to use OP2 with IP1 to create below output -
Code:
I|A|SAMPL|OP|12345
I need some help around the second part on how to use the starting position and insert the pipe.
And please note this would be a generic solution, as the IP2 would always change and the position where the pipe needs to be inserted will also change with that.