View previous topic :: View next topic
|
Author |
Message |
sriramd
New User
Joined: 02 Nov 2006 Posts: 10
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
sha_nathan
New User
Joined: 01 Mar 2006 Posts: 1
|
|
|
|
Can we do this via sort? |
|
Back to top |
|
|
tchen40
New User
Joined: 12 Sep 2007 Posts: 30 Location: Los Angeles, Ca
|
|
Back to top |
|
|
tchen40
New User
Joined: 12 Sep 2007 Posts: 30 Location: Los Angeles, Ca
|
|
|
|
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 |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It is probably in JCL because it is a Syncsort question and got moved from DFSORT . . . |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|