View previous topic :: View next topic
|
Author |
Message |
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
Hi,
I have an input file of having variable record length 2000, i want to write all the i/p records into outfile( of having fixed length 1000).
we can do this using program also, i want to do this using JCL sort/Icetool.
Please find below example.
1) if the input file have spaces in 1001 to 1010 positions, write only the record from 1 to 1000 positions to o/p file.
2) if the i/p file have any data from 1001 to 1010 positions (atleast any single character in any of these positions), write the record from 1 to 1000 bytes as one record and 1001 to 2000 as another record.
Ram. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If all of the input is 2000-byte records, why is the file variable?
If the records are not all 2000, how can it be determined where/how to split the "record"? Code cannot reference byte 1010 if the actual record length is 1000. . . |
|
Back to top |
|
|
Rambhupalchowdary
New User
Joined: 19 Aug 2010 Posts: 47 Location: Hyderabad
|
|
|
|
Hi Dick,
thanks for your reply.
Actually maximum input LRECL is 2000 ( VB). so few input records are record length < 1000 and few are > 1000.
suppose if of the input record is 1500 bytes, we need to split it and write as 2 records in output. first 1000 bytes as one record and remaining data as next record.
i got it using below sort card. please check it.
1)First convert Variable to fixed block
OPTION COPY
OUTFIL VTOF,OUTREC=(5,2000)
2)
SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN=(1001,10,CH,NE,C' '),
BUILD=(1,1000,/,1001,1000)),
IFTHEN=(WHEN=(1001,10,CH,EQ,C' '),
BUILD=(1,1000))
its working.
Ram. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Rambhupalchowdary,
Quote: |
Actually maximum input LRECL is 2000 |
If maximum input LRECL is 2000, then how did you below card working?
Code: |
OPTION COPY
OUTFIL VTOF,OUTREC=(5,2000) |
Could you post SYSOUT(s) from the steps that ran successfully?
Thanks, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It depends on what is considered "working". . .? |
|
Back to top |
|
|
|