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
 

 

How to insert a delimiter after every 5 bytes using sort
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
spamidighantam

New User


Joined: 30 Aug 2006
Posts: 8

PostPosted: Fri Mar 16, 2012 11:57 am    Post subject: How to insert a delimiter after every 5 bytes using sort
Reply with quote

Hi,

Would you please help to insert a delimiter '+' in between every 5 bytes in a file. The record length is 6000. It should insert '+' after every 5 bytes till it reaches of end of record or a blank space. For example,

input
Code:
ABCDEFGHIJKLMNOPQRSTUVWXYZ1234


output
Code:
ABCDE+FGHIJ+KLMNO+PQRST+UVWXY+Z1234
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 16, 2012 1:00 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

Well, what is wrong with typing-up a BUILD with 1,200 different elements? :-)

We know the LRECL of your file, what is the RECFM? How many records will be processed?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Mar 16, 2012 1:03 pm    Post subject:
Reply with quote

If file size is small, REXX can do this 'with less amount of code' not necessarily resource-effecient than SORT.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Mar 16, 2012 1:09 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

as usual there is something untold here ...

if the input record length is 6000 and all the columns are filled,
then the output record length will be 7199

unless each 5 bytes chunk must be + terminated and in this case,
the output record length will be 7200

meditate and consider describing better the whole requirement
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 16, 2012 1:54 pm    Post subject:
Reply with quote

if the delimiters were to be inserted at irregular intervals,
this requirement could make sense.

but, since every 5 bytes is to be delimited,
one asks: Why is this necessary?

A REXX Script could generate the BUILD control cards very easily.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Mar 16, 2012 8:04 pm    Post subject:
Reply with quote

spamidighantam,
May be a crude way but see if below works... (UNTESTED)....
Code:
//STEP0001 EXEC PGM=ICETOOL                     
//TOOLMSG  DD  SYSOUT=*                         
//DFSMSG   DD  SYSOUT=*                         
//IN       DD  INPUT FB/6000                   
//OUT      DD  OUTPUT FB/6                     
//TOOLIN   DD  *                               
 RESIZE FROM(IN) TO(OUT) TOLEN(5) USING(CTL1)   
/*                                             
//CTL1CNTL DD *                                 
   OUTFIL FNAMES=OUT,BUILD=(1,5,C'+')           
/*                                             
//SYSOUT   DD  SYSOUT=*                         
//*                                             
//STEP0002 EXEC PGM=ICETOOL                     
//TOOLMSG  DD  SYSOUT=*                         
//DFSMSG   DD  SYSOUT=*                         
//IN       DD  INPUT FB/6 FROM STEP0001 ABOVE   
//FINOUT   DD  OUTPUT FB/6                     
//TOOLIN   DD  *                               
 RESIZE FROM(IN) TO(OUT) TOLEN(6120) USING(CTL1)
/*                                             
//CTL1CNTL DD *                                 
 OUTFIL FNAMES=FINOUT,BUILD=(1,6199)           
/*                                             
//SYSOUT   DD  SYSOUT=*                         
//*                                             

Thanks,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 16, 2012 8:12 pm    Post subject:
Reply with quote

sqlcode1,
a nice way to start the weekend......
Back to top
View user's profile Send private message
spamidighantam

New User


Joined: 30 Aug 2006
Posts: 8

PostPosted: Fri Mar 16, 2012 8:17 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

Thank you all for your responses.

Hi enrico-sorichetti,

The input file record length is 6000. Of course, when we insert '+' after every 5 bytes the length will be increased as you said. Can this be achieved through SORT ? Please advice.

Hi dbzTHEdinosauer,

Yes, you got my requirement. If REXX can create BUILD script. Could you please let me know the necessary BUILD script. So that I can write REXX program to repeat the BUILD script. Thank you.


Thanks,
Sreedhar
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 16, 2012 8:22 pm    Post subject:
Reply with quote

for f*** sake,

look at sqlcode1's solution..................................
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Mar 16, 2012 8:41 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
sqlcode1,
a nice way to start the weekend......


... and it's Paddy's Day tomorrow !!!

Garry
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 16, 2012 8:45 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

I asked how many records. I asked about your RECFM.

If you have a lot of records, you may not want to chop them and put them together.

If we go with RECFM F, you have explain the bit about the blanks arriving. If one record has 50 of your groups and another 1200 and another one or three, what do you want to do? Get rid of the blanks? Or, if RECFM V, are there still blanks, etc.

If you are complete in your description, input, sample output, rules from how to get there, anything you can think of that we can otherwise only guess, then you'll get answers to match.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 16, 2012 8:52 pm    Post subject:
Reply with quote

though i would not worry too much about number of records,
since the temp file is only 5 char,
Bill you are correct about the space stuff.

Sqlcode1,

would a
SQZ spaces to nothing and then a REP '++' ' ' after the BUILD work?

anything would be better than 1200 BUILD statements
Back to top
View user's profile Send private message
spamidighantam

New User


Joined: 30 Aug 2006
Posts: 8

PostPosted: Fri Mar 16, 2012 9:23 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

Record length is 6000. Its is variable format.. I have attached the screen shot of actual input file. I need to insert '+' after every 5 bytes till I reach a space or end of record.
Back to top
View user's profile Send private message
spamidighantam

New User


Joined: 30 Aug 2006
Posts: 8

PostPosted: Fri Mar 16, 2012 9:28 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

sorry here is the input file
ugly image deleted icon_cool.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 16, 2012 9:40 pm    Post subject:
Reply with quote

is it a fixed length or variable length record?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Mar 16, 2012 9:48 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

do not post screen shots they just clutter the forum, nothing that a text cut and paste would not do.

apart that the jpeg posted is unreadable because of the ugly colors.

image deleted
Back to top
View user's profile Send private message
spamidighantam

New User


Joined: 30 Aug 2006
Posts: 8

PostPosted: Fri Mar 16, 2012 10:19 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

It is variable length like below.


Code:
EEGqd0100EEGqb0110EEGqa0120EEGqc0130EEGsJ0140EEGqZ0150EEGZZ
HVAb80040HVPb80045EHSb80045704000050704100100RIV5T0200                         
REBXd0010REBXe0020REBXf0030REBXg0040REBXI0050                                   
REAaM0010READs0020                                                             
CCPVh0010CCPDq0020                                                             
639100010                                                                       
RMMaV0010                                                                       
CMGLo0010                                                                       
639200010                                                                       
621400010621500020                                                             
TORLm0010                                                                       
RZZF60100RZZrj0150909600200                                                     
THMy50010THMy60020THMrj0030
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Mar 16, 2012 10:20 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

the code tags ... icon_evil.gif
Your post was edited to provide them
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 16, 2012 10:35 pm    Post subject:
Reply with quote

i would like to see the 3.2 I for the input file,
to insure that it is a variable and not fixed length file,
as the control cards will be different.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Mar 16, 2012 10:45 pm    Post subject: Reply to: How to insert a delimiter after every 5 bytes usin
Reply with quote

Some of that data only has nine bytes before the first space. How is that supposed to work?

EDIT: In fact, only one of the sample records shown is a multiple of five. What was that? Mass typo?
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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