IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Splitting single record in to 2 records based on condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Mon Oct 04, 2010 12:45 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Oct 04, 2010 7:36 pm
Reply with quote

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
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Tue Oct 05, 2010 12:02 pm
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Oct 05, 2010 10:16 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Oct 05, 2010 10:44 pm
Reply with quote

Hello,

Quote:
its working.
It depends on what is considered "working". . .?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top