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
 

 

Inserting Leading zeroes through Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Oct 03, 2013 8:01 pm    Post subject: Inserting Leading zeroes through Sort
Reply with quote

Hi,

I have a requirement as below for which I would need advise:

Requirement:
Code:

I/P File FB/LRECL=255

Header<blank----spaces>
99999999<blank-----spaces>                 ---*digits would be less than 16
888888<blank-----spaces>                         bytes of varied length.
7777777<blank----spaces>


I would like to have my ouput file as: <FB LRECL=255>

Code:
Header<blank-----spaces>
----16th bytes-------|----rest blank spaces|
0000000099999999<blank----spaces>   ---*Leading zeroes would be
0000000000888888<blank----spaces>        inserted but overall numeric
0000000007777777<blank----spaces>        part's length would be 16.


Can someone please help in achieving this through sort?

Regards,
Souren

Code'd
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 04, 2013 3:35 am    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

without code tags it is impossible to provide you with a solution.

Is your data like this?

Code:

HEADER                                       
----+----1----+----2----+----3----+----4----+
99999999        SOME OTHER DATA1             
888888          SOME OTHER DATA2             
7777777         SOME OTHER DATA3             


or like this

Code:

HEADER                                       
----+----1----+----2----+----3----+----4----+
99999999 SOME OTHER DATA1             
888888 SOME OTHER DATA2             
7777777 SOME OTHER DATA3             


If it is case # 1 then it is quite simple. USE OVERLAY treating the first 16 bytes as UFF and use M11 edit mask with a length of 16

If the data looks like case # 2 then you need to parse the data using ENDBEFR=C' ' and then build the record treating the first 16 bytes as UFF and use M11 edit mask with a length of 16 and appending the rest of the data.
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Fri Oct 04, 2013 11:47 am    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

Thanks Kolusu the first option went fine with me. Tried the below sortcard and it worked.

Code:

OUTREC OVERLAY=(1:1,16,UFF,M11,LENGTH=16,239X)


But I have a header part also for which I am trying the below sortcard but it is failing with OUTFIL FNAMES=SORTOF2 getting statement syntax error. Not being able to figure out why.

Code:

SORT FILEDS=COPY
OUTFIL FNAMES=SORTOF1,ENDREC=1
OUTFIL FNAMES=SORTOF2,
OUTREC ITHEN=(WHEN=(1,5,CH,NE,C'<header>'),
OVERLAY=(1:1,16,UFF,M11,LENGTH=16,239X))
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Oct 04, 2013 12:45 pm    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

Hi,

you need to show the job output
Quote:
OUTFIL FNAMES=SORTOF2 getting statement syntax error


The above is insufficient to sort out your issue.

What exactly are you now trying to do ?

Are you trying to write the header in a separate file ?

I doubt you have run what you have posted as I can see other syntax errors

Code:

SORT FILEDS=COPY


FILEDS should be FIELDS


Code:
OUTREC ITHEN=(WHEN


ITHEN should be IFTHEN

maybe this might help

Code:
 SORT FIELDS=COPY                                 
 OUTFIL FNAMES=SORTOF1,ENDREC=1                   
 OUTFIL FNAMES=SORTOF2,                           
        IFTHEN=(WHEN=(1,5,CH,NE,C'<HEADER>'),     
 OVERLAY=(1:1,16,UFF,M11,LENGTH=16,239X))         



Gerry
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Fri Oct 04, 2013 1:37 pm    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

Thanks gcichet.

Sorry for the the typos(FILEDS,ITTHEN) they are because of I didn't actually copy paste my card from mainframe, my shop doesn't let me do so.

But the problem still I'm facing is like below:

Code:

SORT FILEDS=COPY
OUTFIL FNAMES=SORTOF1,ENDREC=1
OUTFIL FNAMES=SORTOF2,                           
        IFTHEN=(WHEN=(1,5,CH,NE,C'<HEADER>'),     
        *
 OVERLAY=(1:1,16,UFF,M11,LENGTH=16,239X)) 



OUTFIL STATEMENT : SYNTAX ERROR

And yes I'm trying to create two output files this time first one with Header.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 04, 2013 1:39 pm    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

From the sample input you showed earlier, I think you should be using the PARSE suggestion anyway,
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 04, 2013 6:13 pm    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

ksouren007,

Why are you trying to split the header into a separate file? Is it because the UFF is translating that zeros? You could have avoided that by using an IFTHEN statement.

Is your intention to just copy the first 16 bytes and then pad with spaces for the rest of 255 bytes? Don't you need the data from byte 17 onwards?

If you indeed want only the first 16 bytes other than the header record , you can simply use the following. This will leave the header record as is but pad the numeric values with leading zeroes.

Code:

//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=(1,6,CH,NE,C'HEADER'),     
  BUILD=(1,16,UFF,M11,LENGTH=16))               
//*
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Fri Oct 04, 2013 6:36 pm    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

Thankls Skolusu..It worked perfectly!!

Yes the OUTREC IFTHEN was not working and UFF was prefixing the header with zeroes so I tried putting them in a seperate file.
Also I wont need the bytes beyond 16th position but wanted to initialize them as spaces so used that 239X.

Your sort card worked great, I just added a line to remove duplicates also.
Thanks for your help once again!

Code:

//SYSIN    DD *                                 
  SORT FIELDS=(1,16,CH,A)                                   
  INREC IFTHEN=(WHEN=(1,6,CH,NE,C'HEADER'),     
  BUILD=(1,16,UFF,M11,LENGTH=16))   
  SUM FIELDS=NONE             
//*
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Fri Oct 04, 2013 8:12 pm    Post subject:
Reply with quote

Skolusu,

One small question:

Can I include another 'AND' condition in my IFTHEN=WHEN card to include a numeric value check also...What I'm trying to get is somewhat as below:

INREC IFTHEN=(WHEN=(1,6,CH,NE,C'HEADER' and 1,16,FS,EQ,NUM)

Can it be included? Please advise.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 04, 2013 10:02 pm    Post subject: Reply to: Inserting Leading zeroes through Sort
Reply with quote

Why don't you describe what it is that you want to do. Show a sample input file and expected output from that sample input. If you want to know what field-types you can use NUM with, why don't you look at the manual?
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
Page 1 of 1

 

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