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 include the leading zeros using SYNCSORT

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

New User


Joined: 09 Oct 2007
Posts: 22
Location: chennai.India

PostPosted: Tue Oct 09, 2007 2:04 pm    Post subject: How to include the leading zeros using SYNCSORT
Reply with quote

Let me know how to include leading zeros in the output while using sort conditions.

Ex:

Input:

Code:

REGP      O000000031420071009


Expected output:

Code:

REGP      O000000031220071009


SORT condititon used by me:

Code:

//SYSIN  DD *                             
  SORT FIELDS=COPY                         
  OUTREC FIELDS=(-2,ADD,12,10,ZD)
/*     



Note: But i failed in getting my output correctly.


Could any one suggest me the right SORT CONDITION in achieving this Output !
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Oct 09, 2007 2:25 pm    Post subject: Re: How to include the leading zeros while performing SORT
Reply with quote

What does your incorrect output look like?
Back to top
View user's profile Send private message
NAGARJUN CARALAPATI

New User


Joined: 09 Oct 2007
Posts: 22
Location: chennai.India

PostPosted: Tue Oct 09, 2007 3:27 pm    Post subject:
Reply with quote

My incorrect output look like below :

Code:

            312             


nothing more mentioned above is in my output.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Oct 09, 2007 3:39 pm    Post subject: Re: How to include the leading zeros while performing SORT
Reply with quote

Are you saying that
Code:
REGP      O000000031220071009
becomes
Code:
            312             
Does the 312 shift?
Or is it actually
Code:
                  312             
Since you did not include the 1-11 and 22-end in the outrec, why would you expect them to be there?
As far as the leading zero suppression goes, that mask may be the default, what have you found in the manual?
Back to top
View user's profile Send private message
NAGARJUN CARALAPATI

New User


Joined: 09 Oct 2007
Posts: 22
Location: chennai.India

PostPosted: Tue Oct 09, 2007 3:55 pm    Post subject:
Reply with quote

I didnt include the 1-11 and 22--- in the outrec knowingly.

I want only the '312' alone in the output but with leading Zeroes,i.e as given below.

0000000312
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Oct 09, 2007 3:59 pm    Post subject:
Reply with quote

Have you looked at edit masks in the sort manual?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:02 pm    Post subject: Reply to: How to include the leading zeros while performing
Reply with quote

Quote:
OUTREC FIELDS=(-2,ADD,12,10,ZD)


What are you trying to do with the above SORT ccondition? What is the need for starting from 12th position?

Do post your requirement clearly. Leading Zeroes can be added using Proper EDIT MASKS. We would be able to help if you post your requirement clearly.
Back to top
View user's profile Send private message
NAGARJUN CARALAPATI

New User


Joined: 09 Oct 2007
Posts: 22
Location: chennai.India

PostPosted: Tue Oct 09, 2007 4:03 pm    Post subject:
Reply with quote

No i didnt look at, could you tell me where the SORT manuals are ?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 4:05 pm    Post subject:
Reply with quote

Nagarjun,

You may use the following -

Code:
----+----1----+----2----+----3----+----4----+----5----+
***************************** Top of Data *************
//SORTIN DD *                                         
REGP      O000000031420071009                         
REGP      O000000031220071009                         
/*                                                     
//SORTOUT DD SYSOUT=*                                 
//SYSIN DD *                                           
  OPTION COPY                                         
  OUTREC FIELDS=(12,10,ZD,SUB,+2,EDIT=(TTTTTTTTTT))   
/*                                                     


OP as expected.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:15 pm    Post subject: Reply to: How to include the leading zeros while performing
Reply with quote

Murali,

Quote:
OUTREC FIELDS=(12,10,ZD,SUB,+2,EDIT=(TTTTTTTTTT))


Guess we need to add few more T's in the EDIT MASK.

Code:

OUTREC FIELDS=(12,10,ZD,SUB,+2,EDIT=(TTTTTTTTTTTTTTT)) 


output:

Code:

000000031420069
000000031220069


5 leading zeroes were not displayed as per your sort card.
Back to top
View user's profile Send private message
NAGARJUN CARALAPATI

New User


Joined: 09 Oct 2007
Posts: 22
Location: chennai.India

PostPosted: Tue Oct 09, 2007 4:16 pm    Post subject:
Reply with quote

Thanks a lot. The above mentioned SORT condition is working exactly.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 4:20 pm    Post subject:
Reply with quote

Aaru,

Quote:
0000000312

Nagarjun wanted OP in the above format. Refer 5th post in this topic.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:23 pm    Post subject: Reply to: How to include the leading zeros while performing
Reply with quote

Nagarjuna,


You can also use the available edit mask in the sort card.

Code:
OUTREC FIELDS=(12,10,ZD,SUB,+2,M11,LENGTH=15)


The output is the same.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:28 pm    Post subject: Reply to: How to include the leading zeros while performing
Reply with quote

murali,

Quote:
Nagarjun wanted OP in the above format. Refer 5th post in this topic.


Yes, when i ran the jcl with the code that you had posted the output was

Code:
0031420069
0031220069


and not

Code:

000000031420069
000000031220069


Please let me know if your output is different from the one that i have pasted above.
Back to top
View user's profile Send private message
NAGARJUN CARALAPATI

New User


Joined: 09 Oct 2007
Posts: 22
Location: chennai.India

PostPosted: Tue Oct 09, 2007 4:31 pm    Post subject:
Reply with quote

Aaru,
Thanks !! even this condition is working fine.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 4:32 pm    Post subject:
Reply with quote

Aaru,

Code:
----+----1----+----2----+----3----+----4----+----5---
//SYSOUT DD SYSOUT=*                                 
//SYSPRINT DD SYSOUT=*                               
//SORTIN DD *                                       
REGP      O000000031420071009                       
REGP      O000000031220071009                       
/*                                                   
//SORTOUT DD SYSOUT=*                               
//SYSIN DD *                                         
  OPTION COPY                                       
  OUTREC FIELDS=(12,10,ZD,SUB,+2,EDIT=(TTTTTTTTTT)) 
/*                                                   


Try now. I had used QUOTE tag instead of CODE tag in my previous post. Because of which you have not got proper alignment.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:43 pm    Post subject: Reply to: How to include the leading zeros while performing
Reply with quote

Murali,

I tried again with the code posted in your last post and the output that i got is

Code:
0031420069
0031220069



Could you please post the output that you had got by executing the JCL? Has this got something to do with the version?
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm


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