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

Splitting a Larger record to a smaller record


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sriramd

New User


Joined: 02 Nov 2006
Posts: 10

PostPosted: Wed Sep 12, 2007 10:57 pm
Reply with quote

Hi,

I have a 160 byte record(Input) which needs to be split into a 80 byte record(Output). The conditions are as follows:

a. If there is any data after the 80th byte, write it as 2 records - 1st one with the first 80 bytes and the 2nd one with the rest 80 bytes. The 2nd one should follow the first record in the output file.

b. If there are spaces from 81-160 bytes of Input record, we need to write only the first 80 bytes to the output file.

Note: We do not have DFSORT.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Sep 13, 2007 12:00 am
Reply with quote

Should be a simple REXX, something like:
Code:
ADDRESS TSO "EXECIO * DISKR input (ATEM IN. FINIS"
 
DROP OUT.
O   = 0
 
DO I = 1 TO IN.0
  IF SUBSTR(IN.I,80,1) = ' ' THEN DO
    O = O + 1
    OUT.O = SUBSTR(IN.I,1,80)
  END
  ELSE DO
    O = O + 1
    OUT.O = SUBSTR(IN.I,1,80)
    O = O + 1
    OUT.O = SUBSTR(IN.I,81)
  END
END I

ADDRESS TSO "EXECIO "O" DISKW output (STEM OUT. FINIS"


O.
Back to top
View user's profile Send private message
sha_nathan

New User


Joined: 01 Mar 2006
Posts: 1

PostPosted: Thu Sep 13, 2007 12:34 am
Reply with quote

Can we do this via sort?
Back to top
View user's profile Send private message
tchen40

New User


Joined: 12 Sep 2007
Posts: 30
Location: Los Angeles, Ca

PostPosted: Thu Sep 13, 2007 2:38 am
Reply with quote

yes...

ftp.software.ibm.com/storage/dfsort/mvs/sortbynd.pdf

Please see page the bottom of page 17 for an example of the OUTFIL operand. I believe that'll do what you need.
Back to top
View user's profile Send private message
tchen40

New User


Joined: 12 Sep 2007
Posts: 30
Location: Los Angeles, Ca

PostPosted: Thu Sep 13, 2007 2:40 am
Reply with quote

tchen40 wrote:
yes...

ftp.software.ibm.com/storage/dfsort/mvs/sortbynd.pdf

Please see page the bottom of page 17 for an example of the OUTFIL operand. I believe that'll do what you need.



I sort of take it back. I forgot you needed to dump the record if it were all blanks. What yu can do is split the record into 2 80 byte records first, save the file and then run it through IEBGENER and look for blanks records, atn which time you could discard them.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Thu Sep 13, 2007 2:47 am
Reply with quote

Refering only to original poster, why is this question in JCL forum?
Ignorance of what JCL is and program ( including utility ) is?

??
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: Thu Sep 13, 2007 3:18 am
Reply with quote

Hello,

It is probably in JCL because it is a Syncsort question and got moved from DFSORT . . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Sep 13, 2007 3:42 am
Reply with quote

sriramd,

I don't usually answer questions on Syncsort, but I'm feeling generous today and I don't like the implication that it can't be done in one pass with sort, since it can. I assumed, as you implied in your description, that if 1-80 is blank you want the record, but if 81-80 is blank, you don't. Here are the DFSORT control statements - I'd guess they'd work with Syncsort as well.

Code:

  OPTION COPY                                 
  OUTFIL IFTHEN=(WHEN=(81,80,CH,EQ,C' '),     
    BUILD=(1,80)),                             
   IFTHEN=(WHEN=NONE,                         
    BUILD=(1,80,/,81,80))                     
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 -> JCL & VSAM

 


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 To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top