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
 

 

SORT control card needed
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Jun 12, 2012 7:48 pm    Post subject: SORT control card needed
Reply with quote

I have 2 files, and needs to get output using SORT

file-1
Code:
AB00001   X12
AB00002MACY12
 *          BBCZ34

File-2
Code:
AB00002AAAX12
AB00003CCCY13
AB00004SSSU32


If first 7 positions matches from both the file then
then from 8th position I i have to check for spaces or MAC then move 'N' to last byte of that record else 'M'

output:
Code:
AB000001   X12N
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 12, 2012 8:08 pm    Post subject:
Reply with quote

Do you need output like this

Code:
AB00001   X12N
AB00002MACY12N
 *          BBCZ34M
Or

Code:
AB00001   X12     N 
AB00002MACY12     N
 *          BBCZ34M
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Jun 12, 2012 8:31 pm    Post subject:
Reply with quote

I have to skip the record where first 7 postions are equal to ' * '
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Jun 12, 2012 8:32 pm    Post subject:
Reply with quote

So final output would be
Code:

AB00001   X12N
AB00002MACY12N
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 12, 2012 8:54 pm    Post subject:
Reply with quote

Try this

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//INA      DD *
AB00001   X12
AB00002MACY12
 *          BBCZ34
//INB      DD *
AB00001   X12
AB00002AAAX12
AB00003CCCY13
AB00004SSSU32
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  JOINKEYS F1=INA,FIELDS=(1,7,A)
  JOINKEYS F2=INB,FIELDS=(1,7,A)
  REFORMAT FIELDS=(F1:1,13)
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=(8,1,CH,EQ,C' '),BUILD=(1,13,14:C'N')),
        IFTHEN=(WHEN=NONE,BUILD=(1,13,14:C'M'))
//*
//JNF1CNTL DD *
  OMIT COND=(1,7,CH,EQ,C'*******')
//*


Output
Code:
AB00001   X12N
AB00002MACY12M
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Tue Jun 12, 2012 9:12 pm    Post subject:
Reply with quote

Pandora-Box,

Rohit wants 'N' @ 14th position when there are 'spaces' OR 'MAC' @ 8th position else 'M'. Correct me if I am wrong.

Also, Rohit, you have '*' in 2nd position in your data. (You can change the sort card accordingly).

Hope this helps.

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//INA      DD *
AB00001   X12
AB00002MACY12
AB00099TSTY12
 *          BBCZ34
//INB      DD *
AB00001XYZX12
AB00002AAAX12
AB00003CCCY13
AB00004SSSU32
AB00099TS2Y12
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  OMIT COND=(2,1,CH,EQ,C'*')
  JOINKEYS F1=INA,FIELDS=(1,7,A),SORTED,NOSEQCK
  JOINKEYS F2=INB,FIELDS=(1,7,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,13)
  OUTREC IFTHEN=(WHEN=(8,3,CH,EQ,C'   ',OR,8,3,CH,EQ,C'MAC'),
                BUILD=(1,13,14:C'N')),
         IFTHEN=(WHEN=NONE,
                BUILD=(1,13,14:C'M'))

O/P:
Code:
AB00001   X12N
AB00002MACY12N
AB00099TSTY12M
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 12, 2012 9:38 pm    Post subject:
Reply with quote

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
AB00001       X12
AB00002MACY12
 *           BBCZ34
//INB DD *
AB00001 X12
AB00002AAAX12
AB00003CCCY13
AB00004SSSU32
//SORTOUT DD SYSOUT=*
//SYSIN DD *
 JOINKEYS F1=INA,FIELDS=(1,7,A)
 JOINKEYS F2=INB,FIELDS=(1,7,A)
 REFORMAT FIELDS=(F1:1,13)
 SORT FIELDS=COPY
 OUTREC IFTHEN=(WHEN=(8,1,CH,EQ,C' ',OR,8,3,CH,EQ,C'MAC'),BUILD=(1,13,14:C'N')),
                IFTHEN=(WHEN=NONE,BUILD=(1,13,14:C'M'))
//*
//JNF1CNTL DD *
 OMIT COND=(1,7,SS,EQ,C'*')


Hi Naish,

We both missed icon_sad.gif

OMIT should use SS rather than CH
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 13, 2012 12:21 am    Post subject:
Reply with quote

Pandora-Box wrote:

Is there a place where I could learn how sort inteprets these things

I believe it won't be available for layman like me icon_sad.gif


Pandora-Box,

Contrary to your name , you need to OPEN the box (manuals) that internet gave you. icon_biggrin.gif There is nothing cryptic about how BUILD or OVERLAY works. The manuals explains in detail about these parms. If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080

And most DFSORT keywords follow the actual English meaning. So BUILD is actually building a record from scratch where as OVERLAY is just overlaying in a particular position with already built record.

When you use OVERLAY beyond the record length it is same as BUILD.


The most important Flowchart you need to keep in mind is this

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/1.5.4?

It shows you where and how each DFSORT keywords are processed.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 13, 2012 12:26 am    Post subject:
Reply with quote

oh btw you can completely avoid the IFTHEN and use a simple CHANGE command to build the record.

Code:

//SYSIN DD *                                               
  JOINKEYS F1=INA,FIELDS=(1,7,A)                           
  JOINKEYS F2=INB,FIELDS=(1,7,A)                           
  REFORMAT FIELDS=(F1:1,13)                                 
  OPTION COPY                                               
  INREC BUILD=(1,13,8,3,CHANGE=(1,C'   ',C'N',C'MAC',C'N'),
                        NOMATCH=(C'M'))                     
//*


or
Code:

//SYSIN DD *                                               
  JOINKEYS F1=INA,FIELDS=(1,7,A)                           
  JOINKEYS F2=INB,FIELDS=(1,7,A)                           
  REFORMAT FIELDS=(F1:1,13)                               
  OPTION COPY                                             
  INREC OVERLAY=(14:8,3,CHANGE=(1,C'   ',C'N',C'MAC',C'N'),
                        NOMATCH=(C'M'))                   
//*                                                       
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Jun 13, 2012 6:13 pm    Post subject: Reply to: SORT control card needed
Reply with quote

Thanks a lot everyone.
I would try these options and come back agian.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Jun 19, 2012 8:29 pm    Post subject:
Reply with quote

I have tried with ,

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//INA      DD *
AB00001   X12
AB00002MACY12
AB00099TSTY12
 *          BBCZ34
//INB      DD *
AB00001XYZX12
AB00002AAAX12
AB00003CCCY13
AB00004SSSU32
AB00099TS2Y12
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  OMIT COND=(2,1,CH,EQ,C'*')
  JOINKEYS F1=INA,FIELDS=(1,7,A),SORTED,NOSEQCK
  JOINKEYS F2=INB,FIELDS=(1,7,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,13)
  OUTREC IFTHEN=(WHEN=(8,3,CH,EQ,C'   ',OR,8,3,CH,EQ,C'MAC'),
                BUILD=(1,13,14:C'N')),
         IFTHEN=(WHEN=NONE,
                BUILD=(1,13,14:C'M'))


and it is ok, but if the match is not there then I want to add 'N' at the last byte of the record from the first input file and write it to a output file.
Could you please help to modify the above controld card??
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 19, 2012 9:26 pm    Post subject:
Reply with quote

add this line before REFORMAT statement in your control cards
Code:

JOIN UNPAIRED,F1


Check this link which explains in detail about JOIN statement

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.4?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Jun 20, 2012 6:10 pm    Post subject:
Reply with quote

Thank you Skolusu, I will try it.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Mon Jun 25, 2012 7:20 pm    Post subject: Reply to: SORT control card needed
Reply with quote

I am now using below SORT card,

Code:
SORT FIELDS=(1,16,CH,A)                                     
 SUM FIELDS=NONE                                             
 OPTION COPY                                                 
 OMIT COND=(2,1,SS,EQ,C'*')                                   
 JOINKEYS F1=INA,FIELDS=(1,10,A),SORTED,NOSEQCK               
 JOINKEYS F2=INB,FIELDS=(1,10,A),SORTED,NOSEQCK               
 JOIN UNPAIRED,F1                                             
 REFORMAT FIELDS=(F1:1,112,F2:340,3)                         
OUTREC IFTHEN=(WHEN=(113,3,CH,EQ,C'   ',OR,113,3,CH,EQ,C'MAA',
               OR,113,3,CH,EQ,C'MAE',OR,113,3,CH,EQ,C'MAD'), 
               BUILD=(1,112,113:C'N')),                       
        IFTHEN=(WHEN=NONE,                                   
               BUILD=(1,112,113:C'M'))                       


Here, if I want to get two output files like
1) one file will be created newly with DISP=(new,catlg,delete)
2)second file will be with DISP=SHR mode

then how to go ahead with this.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Mon Jun 25, 2012 7:48 pm    Post subject: Re: Reply to: SORT control card needed
Reply with quote

Rohit Umarjikar wrote:
I am now using below SORT card,

Code:
SORT FIELDS=(1,16,CH,A)                                     
 SUM FIELDS=NONE                                             
 OPTION COPY                                                 
 OMIT COND=(2,1,SS,EQ,C'*')                                   
 JOINKEYS F1=INA,FIELDS=(1,10,A),SORTED,NOSEQCK               
 JOINKEYS F2=INB,FIELDS=(1,10,A),SORTED,NOSEQCK               
 JOIN UNPAIRED,F1                                             
 REFORMAT FIELDS=(F1:1,112,F2:340,3)                         
OUTREC IFTHEN=(WHEN=(113,3,CH,EQ,C'   ',OR,113,3,CH,EQ,C'MAA',
               OR,113,3,CH,EQ,C'MAE',OR,113,3,CH,EQ,C'MAD'), 
               BUILD=(1,112,113:C'N')),                       
        IFTHEN=(WHEN=NONE,                                   
               BUILD=(1,112,113:C'M'))                       


Here, if I want to get two output files like
1) one file will be created newly with DISP=(new,catlg,delete)
2)second file will be with DISP=SHR mode

then how to go ahead with this.


Why whould you want to create a file with disp=shr?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Jun 25, 2012 8:32 pm    Post subject: Reply to: SORT control card needed
Reply with quote

So, look at OUTFIL.

If you have a pre-allocated output dataset, write to it with DISP=OLD.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jun 25, 2012 9:30 pm    Post subject: Re: Reply to: SORT control card needed
Reply with quote

Rohit Umarjikar wrote:
I am now using below SORT card,

Code:
SORT FIELDS=(1,16,CH,A)                                     
 SUM FIELDS=NONE                                             
 OPTION COPY                                                 
 OMIT COND=(2,1,SS,EQ,C'*')                                   
 JOINKEYS F1=INA,FIELDS=(1,10,A),SORTED,NOSEQCK               
 JOINKEYS F2=INB,FIELDS=(1,10,A),SORTED,NOSEQCK               
 JOIN UNPAIRED,F1                                             
 REFORMAT FIELDS=(F1:1,112,F2:340,3)                         
OUTREC IFTHEN=(WHEN=(113,3,CH,EQ,C'   ',OR,113,3,CH,EQ,C'MAA',
               OR,113,3,CH,EQ,C'MAE',OR,113,3,CH,EQ,C'MAD'), 
               BUILD=(1,112,113:C'N')),                       
        IFTHEN=(WHEN=NONE,                                   
               BUILD=(1,112,113:C'M'))                       


Here, if I want to get two output files like
1) one file will be created newly with DISP=(new,catlg,delete)
2)second file will be with DISP=SHR mode

then how to go ahead with this.


Why do you have a OPTION COPY and also SORT FIELDS=(1,16,CH,A) for the main task? Why did you move the elimination of * records to the main task from JNF*CNTL?

If you are running Syncsort then please post your questions in the JCL forum and please do not take advantage of people trying to help you.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Jun 27, 2012 3:22 pm    Post subject:
Reply with quote

Craq,
I am replacing my current COBOL program with SORT so whatever the current fuctionality is there, I have to keep them same. And hence I am creating it with SHR.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Jun 27, 2012 4:20 pm    Post subject: Reply to: SORT control card needed
Reply with quote

"DISP=SHR" is nothing to do with "functionality".

It will allow two jobs to access (including write to) the same dataset at the same time.

So, two jobs writing to the same dataset. Or one job writing another reading. At the same time. Dumb-as-all-heck. Review it. Unless it is "protected" from doing such things by some other method, then it should be changed.

I'm sure your spec doesn't really include "provide same functionality even if it is garbage and an accident waiting to happen". If it does, you should at least have something to say about it, not just lie down silently.

If nothing else, you need a CYA memo/e-mail so that you don't get busted for it whilst preparing your "I was warned about this, but you said..." to which the reply is "if I told you to jump off a cliff, would you just do it, because it is in the spec?"
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Wed Jun 27, 2012 6:27 pm    Post subject:
Reply with quote

Hello,

Quote:
I am replacing my current COBOL program with SORT so whatever the current fuctionality is there, I have to keep them same. And hence I am creating it with SHR.


You dont have to follow the same unless it is meant to be.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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