IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

suppress leading zeroes in the output file using a sort card


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Thu Jun 30, 2011 12:04 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 30, 2011 3:07 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Jun 30, 2011 5:44 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 30, 2011 6:37 pm
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: 2481
Location: @my desk

PostPosted: Fri Jul 01, 2011 10:27 am
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
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: 2481
Location: @my desk

PostPosted: Fri Jul 01, 2011 12:08 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top