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

How to include the leading zeros using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2146
Location: At my coffee table

PostPosted: Tue Oct 09, 2007 2:25 pm
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
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: 2146
Location: At my coffee table

PostPosted: Tue Oct 09, 2007 3:39 pm
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
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: 2146
Location: At my coffee table

PostPosted: Tue Oct 09, 2007 3:59 pm
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: 1287
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:02 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 4:05 pm
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: 1287
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:15 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 4:20 pm
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: 1287
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:23 pm
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: 1287
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:28 pm
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
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: 1436
Location: Bangalore,India

PostPosted: Tue Oct 09, 2007 4:32 pm
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: 1287
Location: Chennai, India

PostPosted: Tue Oct 09, 2007 4:43 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
Search our Forums:

Back to Top