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
 

 

need help in synsort

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

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Fri May 08, 2009 10:58 pm    Post subject: need help in synsort
Reply with quote

Hi All,

I have one input file length of 80 bytes.

There is one field at position 71 (lenth of 7 bytes). Lets say user-id.

I need to fetch only user-id from that file and also that field needs to be sorted on ascending order and duplicates needs to be removed.

So the output file should contain only user-id field which is sorted with no-dups.

Can any one help me on this???

thanks in advance.
Back to top
View user's profile Send private message

cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri May 08, 2009 11:46 pm    Post subject: Reply to: need help in synsort
Reply with quote

You need a card to sort:
Code:

 SORT FIELDS=(71,7,CH,A)


You need a card to select the only records with userids ( NE TO BLANK)
Code:

INCLUDE COND=(71,7,CH,NE,C'       ')


You need a card to remove dups:
Code:

 SUM FIELDS=NONE


If you want to have the userid moved to to position 1:
Code:

 OUTREC FIELDS=(1:71,7,8:73C' ')
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Fri May 08, 2009 11:50 pm    Post subject: Reply to: need help in synsort
Reply with quote

Raj12vel,You can try this ,altering the data type if required.
Code:
//JS010  EXEC PGM=SORT                           
//SORTIN   DD DSN=INP.FIL1,     
//            DISP=SHR                           
//SORTOUT  DD DSN=OUT.FIL2,     
//            DISP=SHR                           
//SORTMSG  DD SYSOUT=*                           
//SYSOUT   DD SYSOUT=*                           
//SYSIN    DD *                                 
  SORT  FIELDS=(71,7,CH,A)                     
  SUM  FIELDS=NONE                               
  OUTREC FIELDS=(1:71,7)                       
/*                                               
//


WTH.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Fri May 08, 2009 11:58 pm    Post subject:
Reply with quote

It might be more efficient to select ONLY the required field BEFORE sorting using INREC rather than removing the unwanted fields after sorting using an OUTREC. Just a thought.
Code:
//SYSIN DD *
  INREC BUILD=(71,7)
  SORT FIELDS=(1,7,CH,A)
  SUM FIELDS=NONE
/*
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 12:29 am    Post subject: Reply to: need help in synsort
Reply with quote

Hi all,

Thanks for all your response!!!

the below statement meets my last requirement.

OUTREC FIELDS=(1:71,7,8:73C' ')

but getting an error

INREC RECORD LENGTH = 7
OUTREC FIELD OUTSIDE RANGE

please help me on this.

All other code works fine but getting buffer values at the remaining position of the output file. thats why going for this command to make the remaining field as spaces.
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: Sat May 09, 2009 12:32 am    Post subject:
Reply with quote

Quote:
but getting an error

INREC RECORD LENGTH = 7
OUTREC FIELD OUTSIDE RANGE

please help me on this.
Please provide all your sysouts......
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 12:36 am    Post subject:
Reply with quote

Hi All,

I tried with these cards,

Code:
//SYSIN DD *                           
   SORT FIELDS=(71,7,CH,A)             
   INCLUDE COND=(71,7,CH,NE,C'       ')
   OUTREC FIELDS=(1:71,7,8:73C' ')                             
/*                                     


It works fine. but when i insert sumfields=none, getting an error. here it's go.

Code:
  SORT FIELDS=(71,7,CH,A)             
  INCLUDE COND=(71,7,CH,NE,C'       ')
  OUTREC FIELDS=(1:71,7,8:73C' ')     
  SUMFIELDS=NONE                       


Error:-

SYSIN :
Code:
    SORT FIELDS=(71,7,CH,A)                                     
    INCLUDE COND=(71,7,CH,NE,C'       ')                       
    OUTREC FIELDS=(1:71,7,8:73C' ')                             
    SUMFIELDS=NONE                                             
    *                                                           
 WER901I  **WARNING** SYNCSORT 1.2.3.0 WILL EXPIRE IN 34 DAYS   
 WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT               
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Sat May 09, 2009 12:40 am    Post subject: Reply to: need help in synsort
Reply with quote

There needs to be a space between SUM and FIELDS=NONE
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 12:44 am    Post subject:
Reply with quote

Great!!!

Thanks alot your timed help!!!

icon_lol.gif
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 12:45 am    Post subject:
Reply with quote

Thank you all!!!

All the cards work fine now...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat May 09, 2009 1:06 am    Post subject:
Reply with quote

Hello,

Is there some reason you chose to sort all of the data instead of only the 7 bytes you wanted as output?

If you have 50 records it will not matter, if you have 50 millon records, it will. . .
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 1:27 am    Post subject:
Reply with quote

Need to have it. Thats why. Any ways thanks alot.

Got another situation here.

I have two input files.

1. Length of 80 bytes (user-id at position 71, length of 7 bytes)

2. length of 80 bytes (user-id at position 01,length of 7 bytes)

requirement:-

1. User id needs to be matched with both files,

2. if matches, then all the records from 1st file (80 bytes) and the field from position 09 to 10 (i.e 2 bytes) will be written into the output.

can any one help me on this?
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 1:36 am    Post subject: Need help to write a Syncsort job
Reply with quote

Input:-

I have two input files.

1. Length of 80 bytes (user-id at position 71, length of 7 bytes)

2. length of 80 bytes (user-id at position 01,length of 7 bytes)

requirement:-

1. User id needs to be matched with both files,

2. if matches, then all the records from 1st file (80 bytes) and the field from position 09 to 10 (i.e 2 bytes) will be written into the output.

can any one help me on this?
_________________
icon_redface.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat May 09, 2009 1:55 am    Post subject:
Reply with quote

Hello,

Suggest you look at join/joinkeys in the Syncsort manual.

There are also multiple examples in the forum (SEARCH link is above).

If you find something that is not clear, p[ost what you found and someone will be able to clarify.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Sat May 09, 2009 2:35 am    Post subject:
Reply with quote

Hi,

Got the code for the above question..

Thanks alot.

But if there is no match between the user-id's then need to populate
the value as "???" in the output file?

here what condition we have to include...

here is the code i have used now:-

//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(71,07,A)
JOINKEYS FILE=F2,FIELDS=(01,07,A)
REFORMAT FIELDS=(F1:1,80,F2:9,2)
SORT FIELDS=(71,7,CH,A)
OUTREC FIELDS=(1,80,81,02,83:8C' ')
/*


please help me on this...
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: Sat May 09, 2009 5:16 am    Post subject:
Reply with quote

Have you looked at the idea of mulitpule OUTRECs pointing to the same output?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sat May 09, 2009 9:47 am    Post subject:
Reply with quote

Quote:
But if there is no match between the user-id's then need to populate
the value as "???" in the output file?
raj12vel,

Here mismatch can come both the ways.
1) Key from File1 not present in File2
2) Key from File2 not present in File1

Define your output records for both the above cases.
Back to top
View user's profile Send private message
raj12vel

New User


Joined: 20 Dec 2008
Posts: 43
Location: New Jersey

PostPosted: Mon May 11, 2009 11:17 pm    Post subject:
Reply with quote

1. Input File1

Code:

                                                 USER-ID         
                                                                 
131143305 3899 15.00    20090504 IVR JCPPLCCPBP  G1VPRLT N       
131143317 9626 113.00   20090504 IVR gapplccpbp  IVR     N       
131143332 8117 16.00    20090503 IVR GAPPLCCPBP  IVR     N       
131143383 9039 516.93   20090503 IVR JCPDCPBP    G1VPD1T N       


2. Input file2

Code:


USER-ID     
             
G1VPRLT  cs 
G1VPD1T  cs 


Output file required;-

Code:

                                                 USER-ID    new field   
                                                            from input 2
131143305 3899 15.00    20090504 IVR JCPPLCCPBP  G1VPRLT N  cs         
131143317 9626 113.00   20090504 IVR gapplccpbp  IVR     N  ???         
131143332 8117 16.00    20090503 IVR GAPPLCCPBP  IVR     N  ???         
131143383 9039 516.93   20090503 IVR JCPDCPBP    G1VPD1T N  cs         


Hope this will be useful...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Fri May 15, 2009 10:44 am    Post subject:
Reply with quote

raj12vel,

Your field positions in the sample data(key at pos-50) does n't seem to match with what you've used in your sort cards(pos-71). The below JOIN UNPAIRED application should work for you. You can modify the field positions as in your actual file.
Code:
//STEP1   EXEC PGM=SORT                                   
//SYSOUT    DD SYSOUT=*                                   
//SORTJNF1  DD *                                           
131143305 3899 15.00    20090504 IVR JCPPLCCPBP  G1VPRLT N
131143317 9626 113.00   20090504 IVR GAPPLCCPBP  IVR     N
131143332 8117 16.00    20090503 IVR GAPPLCCPBP  IVR     N
131143383 9039 516.93   20090503 IVR JCPDCPBP    G1VPD1T N
/*                                                         
//SORTJNF2  DD *                                           
G1VPRLT cs                                                 
G1VPD1T cs                                                 
//SORTOUT   DD SYSOUT=*                                   
//SYSIN     DD *                                           
  JOINKEYS FILE=F1,FIELDS=(50,7,A)                         
  JOINKEYS FILE=F2,FIELDS=(01,7,A)                         
  JOIN UNPAIRED,F1                                         
  REFORMAT FIELDS=(F1:1,58,F2:8,4)                         
  INREC IFTHEN=(WHEN=(61,1,CH,EQ,C' '),OVERLAY=(60:C'???'))
  SORT FIELDS=(1,9,CH,A)                                   
SORTOUT
Code:
131143305 3899 15.00    20090504 IVR JCPPLCCPBP  G1VPRLT N cs
131143317 9626 113.00   20090504 IVR GAPPLCCPBP  IVR     N ???
131143332 8117 16.00    20090503 IVR GAPPLCCPBP  IVR     N ???
131143383 9039 516.93   20090503 IVR JCPDCPBP    G1VPD1T N cs
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 Help Skipping Records based on Condit... nartcr SYNCSORT 10 Fri Aug 22, 2014 2:56 am
No new posts Setting RC4 for a specific no. record... pankaj1002 JCL & VSAM 15 Tue Aug 28, 2012 3:08 pm
No new posts Synsort shows on the same outfile as ... ken herbolic JCL & VSAM 21 Sat May 21, 2011 1:36 am
No new posts Synsort - sort records within that pa... pratiksha JCL & VSAM 2 Thu Nov 11, 2010 4:58 pm
No new posts How to do this using SYNSORT.... karthikr44 JCL & VSAM 10 Wed Dec 09, 2009 2:21 pm


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