Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Splitting a Larger record to a smaller record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Splitting a Larger record to a smaller record
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: 2360
Location: Israel

PostPosted: Thu Sep 13, 2007 12:00 am    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

yes...

ftp://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    Post subject:
Reply with quote

tchen40 wrote:
yes...

ftp://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: 456
Location: Belgium

PostPosted: Thu Sep 13, 2007 2:47 am    Post subject:
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

Site Director


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

PostPosted: Thu Sep 13, 2007 3:18 am    Post subject:
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 Moderator


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

PostPosted: Thu Sep 13, 2007 3:42 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us