01CP19841231TRK=99999999REL=DCLS=NDED=NFLT=NTER=NCOM=NAGE=N PPT=99999999REL=NDED=NR45=NAGE=N INC=99999999PIP=NDEV=NPPT=NZON=YNOF=N COMN PIP=NUMP=NUMA=NUND=NEUB=NUNF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N (in one line)
------------------------------------------------------
01CP19850531TRK=19850101REL=DCLS=YDED=YFLT=NTER=NCOM=NAGE=N PPT=99999999REL=NDED=NR45=NAGE=N INC=99999999PIP=NDEV=YPPT=NZON=YNOF=N COMN PIP=NUMP=NUMA=NUND=NEUB=NUNF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N
(in one line)
------------------------------------------------------
01CP19850730TRK=19850101REL=DCLS=YDED=YFLT=NTER=NCOM=NAGE=N PPT=99999999REL=NDED=NR45=NAGE=N INC=99999999PIP=NDEV=YPPT=NZON=YNOF=N COMN PIP=NUMP=NUMA=NUND=NEUB=NUNF=NPIN=NPID=NEPI=NPIE=NPIC=NPIA=N
(in one line)
------------------------------------------------------
It is not properly showing but what i need is in 3 lines of a sequential file by removing in one place spaces and concatenating the wrapped lines.The existing sequential file has record length as 256.Even then why is it wrapping?Is there any way to do this?
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Mon May 19, 2003 4:38 pm Post subject:
sunil,
The following DFSORT/ICETOOL JCl will give you the desired results.The first copy operator splits the input file into 3 files. The first line goes to L1 file ,second
line goes to L2 and 3rd line goes to L3 and this process repeats untill eof.
Now we reformat these 3 files,so that we can get the 3 lines as a single
line.
The first line has only 12 bytes and the rest 244 bytes is spaces. so using
ctl2 we reformat the record
Code:
OUTREC=(1,12,512Z,SEQNUM,8,ZD)
This will create a file T1 with LRECL(12+256+256+ 8 BYTES SEQNUM) = 533.
The first 12 bytes will be from the input file and we will have 512 binary
zeroes to accomdate line2 and line3.At the end of each record we will add a
seqnum so that we can use that for sorting
Similary files T2 and T3 are created.
Now the final sort takes in T1,T2 & T3 and sum sorts on the bytes 13 thru
524, so that the 3 lines from the input file will become 1 line.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue May 20, 2003 5:51 am Post subject:
sunil,
Change the pgm name to SYNCTOOL and you should be able to get the desired results.
Prem kumar's solution is easy and involves less overhead but only restriction is that blocksize should be a multiple of 3. For a file with LRECL of 256 the optimum blocksize is 27904 which is not a multiple of 3.
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Tue May 20, 2003 10:29 am Post subject:
Premkumar,
I had learnt this trick from this site itself. But, there is another "caveat" here. What if the number of records is NOT a multiple of 3 ?
The input dataset looks like as if it was some kind of dump. So, probably, the solution will always work. Using a LRECL as some multiple of the actual LRECL presumes that, the number of records are going to be that some multiple. What if it is NOT, in a more generic scenario ? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Thanks guys for the responses.
We had to go for a work around. The input we had to change had only 500 records. So we downloaded the file and the used an ordinary word editor with macros and then uploaded it back to a sequential file with more record length.
And it worked!!!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum