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
 

 

suppress leading zeroes in the output file using a sort card

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
soumya swain

New User


Joined: 30 Jun 2011
Posts: 4
Location: INDIA

PostPosted: Thu Jun 30, 2011 11:56 am    Post subject: suppress leading zeroes in the output file using a sort card
Reply with quote

Hi All.

I am using ICETOOL utility in my sort jcl. I have 3 input files having numeric data of 12 bytes from 43rd position. The control card looks like this:
//CTL1CNTL DD *
SORT FIELDS=(1,5,CH,A)
OPTION ZDPRINT
SUM FIELDS=(43,12,ZD)
OMIT COND=(1,5,CH,EQ,C'MODEL')
/*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)
/*

It processes all records and includes the HEADER record in the output file. But in my output file , I am having leading zeroes in the numeric section after summation . The output record looks like this:
02354,AAAAAAAAAAAAAAAA ,07/21/2009,Y ,000000050672

My requirement specifies no leading zeroes in the output file:
02354,AAAAAAAAAAAAAAAA ,07/21/2009,Y , 50672
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Jun 30, 2011 12:04 pm    Post subject: Reply to: suppress leading zeroes in the output file using a
Reply with quote

soumya swain,

Welcome to the forums.

Can you post a sample input record and the input as well as expected output file attributes. Also since you posted in JCL forum, I assume your sort product is Syncsort and not DFSORT.
Quote:
It processes all records and includes the HEADER record in the output file
Do you want to omit the header record? If yes, a simple SORT would do and I do not think there's a need for DATASORT here.
Back to top
View user's profile Send private message
soumya swain

New User


Joined: 30 Jun 2011
Posts: 4
Location: INDIA

PostPosted: Thu Jun 30, 2011 2:46 pm    Post subject:
Reply with quote

Hi Arun,

My sample input record looks like this:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
02978,APPLETREE ,02/12/2009,N , 117759

The OUTPUT after summation looks like this (3 similar fields are added):
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
02978,APPLETREE ,02/12/2009,N ,000000353277

The expected OUTPUT is :
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
02978,APPLETREE ,02/12/2009,N , 353277

And I used DATASORT since I wanted to omit the HEADER from processing i.e during the summation . But I also want the HEADER it in my output.
If HEADER is not omitted during processing it sums up the characters of the 'SCORE COUNTS' field :

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
MODEL,IDENTIFICATION ,MM/DD/YYYY,MMM,473900729064

Although it is expected to look like:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
MODEL,IDENTIFICATION ,MM/DD/YYYY,MMM,SCORE COUNTS[/code]
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jun 30, 2011 3:07 pm    Post subject: Reply to: suppress leading zeroes in the output file using a
Reply with quote

Don't you just need SQZ?
Back to top
View user's profile Send private message
soumya swain

New User


Joined: 30 Jun 2011
Posts: 4
Location: INDIA

PostPosted: Thu Jun 30, 2011 4:03 pm    Post subject:
Reply with quote

Hi Bill

I am not able to format my output using SQZ.Actually I am not squeezing the numeric field. I am trying to remove the leading zeroes from that field.

Thanks for the info.
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: Thu Jun 30, 2011 5:44 pm    Post subject:
Reply with quote

Quote:
I am not squeezing the numeric field. I am trying to remove the leading


Removing the leading zeroes, as opposed to replacing them with blanks is exactly what SQZ does. The DFSORT Programming Guide specifically states:
Quote:
Optionally for SQZ, specific characters can be changed to blanks before squeezing begins,....


You don't state why you can't SQZ.

Garry.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Jun 30, 2011 6:21 pm    Post subject:
Reply with quote

I have never figured out why people seem to think that leading zeros are a problem in comma delimited files.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jun 30, 2011 6:37 pm    Post subject: Reply to: suppress leading zeroes in the output file using a
Reply with quote

I agree Craq, I wrote three paragraphs earlier for this topic, then thought I'd better ditch them, as I'm forever telling people to go and get the oddly-produced files from an external system in the correct format.

The only reason I could think of immediately is that if someone wanted to take this and directly put it out as a report/screen without doing any "editing" of the fields. That got me worried about it being "bounced back", so there we go.

Other than for straight display purposes, the field is the same with/without leading zeros.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Fri Jul 01, 2011 10:27 am    Post subject:
Reply with quote

soumya swain,

Your sort card indicates that you're summing a ZD field of length-12 at pos-43. But the sample data does not seem to be of a valid ZD field with length=12. icon_rolleyes.gif

Here's a Syncsort job which I think does what you're trying to do.
(The below job assumes an input of FB/LRECL=80 and the numeric field at 32, length=6.)
Code:
//STEP01   EXEC PGM=SYNCTOOL                                       
//IN       DD *                                                     
MODEL                                                               
02978,APPLETREE ,02/12/2009,N ,117759                               
02978,APPLETREE ,02/12/2009,N ,117759                               
02978,APPLETREE ,02/12/2009,N ,117759                               
03000,APPLETREE ,02/12/2009,N ,000011                               
03000,APPLETREE ,02/12/2009,N ,000022                               
//OUT      DD SYSOUT=*                                             
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  DATASORT FROM(IN) TO(OUT) HEADER USING(CTL1)                     
//CTL1CNTL DD *                                                     
  SORT FIELDS=(1,5,CH,A)                                           
  SUM FIELDS=(32,06,ZD)                                             
  OUTFIL IFTHEN=(WHEN=(1,5,CH,NE,C'MODEL'),                         
         OVERLAY=(32:32,6,ZD,M10,LENGTH=6,32:32,6,SQZ=(SHIFT=LEFT)))
Code:
MODEL                                 
02978,APPLETREE ,02/12/2009,N ,353277
03000,APPLETREE ,02/12/2009,N ,33
Back to top
View user's profile Send private message
soumya swain

New User


Joined: 30 Jun 2011
Posts: 4
Location: INDIA

PostPosted: Fri Jul 01, 2011 11:06 am    Post subject:
Reply with quote

Hi Arun,

I wasnt familiar with SQZ , so couldnt use it properly. But I tried running the sample sort card provided by you. Thats precisely what I needed for my output.

Thanks a lot .

Craq and Bill : Thanks!!! . Actually the output i need is in the form of a report thats nee to be printed. Thats why leading zeroes are to be excluded.

I am extremely happy (especially since this is my first post).
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Fri Jul 01, 2011 12:08 pm    Post subject:
Reply with quote

You're welcome.
Quote:
especially since this is my first post
I thought it was the 4th icon_lol.gif
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
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 CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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