Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
NAGARJUN CARALAPATI

New User

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

Posted: Tue Oct 09, 2007 2:04 pm    Post subject: How to include the leading zeros using SYNCSORT

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 !

CICS Guy

Senior Member

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

 Posted: Tue Oct 09, 2007 2:25 pm    Post subject: Re: How to include the leading zeros while performing SORT What does your incorrect output look like?
NAGARJUN CARALAPATI

New User

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

Posted: Tue Oct 09, 2007 3:27 pm    Post subject:

My incorrect output look like below :

 Code: 312

nothing more mentioned above is in my output.
CICS Guy

Senior Member

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

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

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?
NAGARJUN CARALAPATI

New User

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

 Posted: Tue Oct 09, 2007 3:55 pm    Post subject: 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
CICS Guy

Senior Member

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

 Posted: Tue Oct 09, 2007 3:59 pm    Post subject: Have you looked at edit masks in the sort manual?
Aaru

Senior Member

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

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

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

NAGARJUN CARALAPATI

New User

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

 Posted: Tue Oct 09, 2007 4:03 pm    Post subject: No i didnt look at, could you tell me where the SORT manuals are ?
murmohk1

Senior Member

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

Posted: Tue Oct 09, 2007 4:05 pm    Post subject:

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.
Aaru

Senior Member

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

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

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

NAGARJUN CARALAPATI

New User

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

 Posted: Tue Oct 09, 2007 4:16 pm    Post subject: Thanks a lot. The above mentioned SORT condition is working exactly.
murmohk1

Senior Member

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

Posted: Tue Oct 09, 2007 4:20 pm    Post subject:

Aaru,

 Quote: 0000000312

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

Senior Member

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

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

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.
Aaru

Senior Member

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

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

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.
NAGARJUN CARALAPATI

New User

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

 Posted: Tue Oct 09, 2007 4:31 pm    Post subject: Aaru, Thanks !! even this condition is working fine.
murmohk1

Senior Member

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

Posted: Tue Oct 09, 2007 4:32 pm    Post subject:

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.
Aaru

Senior Member

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

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

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?
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics LRECL in syncsort frozenblood87 SYNCSORT 4 Tue Feb 19, 2019 6:50 am SYNCSORT keep MIN/MAX record Cloink SYNCSORT 16 Mon Sep 17, 2018 3:00 pm INCLUDE 2 conditions to copy in the o... Chiku kumar DFSORT/ICETOOL 10 Tue Jul 03, 2018 7:11 pm Issue in suppressing leading zeros &a... Vijay_Sirisha COBOL Programming 21 Thu Jun 07, 2018 8:01 pm How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us