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
 

 

Sorting Pipe separated file using SYNCSORT

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

New User


Joined: 01 Dec 2006
Posts: 61
Location: Pune

PostPosted: Wed May 09, 2012 6:59 pm    Post subject: Sorting Pipe separated file using SYNCSORT
Reply with quote

Hi,

I am having a File which is having name followd by Deliminator followed by customer number and I want to sort this based on customer number using SYNCSORT I have tried "PARSE" but I am getting SYNTAX error for ENDBFER :


Code:

 INREC PARSE=(%=(ENDBFER=C'|'),   
                 *                 





Input

Code:

|VISHALBSHAH|#_1100000001        0000LGL         
|KHUDDAM-UL-ISLAM|#_0510000001        0001AKA     
|BUBLOO|#_0510000001        0002AKA               
|BABOO|#_0510000001        0003AKA               
|VICKYBSHAH|#_1100000001        0001AKA           
|VICKYBSHAH|#_1100000002        0000LGL           
|VICKYBSHAH|#_1100000002        0001AKA           


I want to sort above input on 2nd field i.e. customer number the output should be :

Code:

     
|KHUDDAM-UL-ISLAM|#_0510000001        0001AKA     
|BUBLOO|#_0510000001        0002AKA               
|BABOO|#_0510000001        0003AKA               
|VISHALBSHAH|#_1100000001        0000LGL   
|VICKYBSHAH|#_1100000001        0001AKA           
|VICKYBSHAH|#_1100000002        0000LGL           
|VICKYBSHAH|#_1100000002        0001AKA   
       


Could someone please , suggest ?
Back to top
View user's profile Send private message

vishalbshah

New User


Joined: 01 Dec 2006
Posts: 61
Location: Pune

PostPosted: Wed May 09, 2012 7:03 pm    Post subject:
Reply with quote

Sorry a TYPO

I am using ENDBEFR not "ENDBFER"
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 09, 2012 7:03 pm    Post subject:
Reply with quote

ENDBEFR?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 09, 2012 7:05 pm    Post subject:
Reply with quote

Then what is the error? as displayed in the jes output,
use cut and paste.

who do you think wants to help you when you post as you did?
Back to top
View user's profile Send private message
vishalbshah

New User


Joined: 01 Dec 2006
Posts: 61
Location: Pune

PostPosted: Wed May 09, 2012 7:12 pm    Post subject:
Reply with quote

Sorry for that

found that Typo but still have not found the solution for sorting

Could you please consider the input as i mentioned above and suggest the control statement I should use

input file is of 200 length and it contains "|" "name" "|" "customer number"

I want to sort on the customer number.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 09, 2012 7:15 pm    Post subject:
Reply with quote

what do your control cards look like,
what error are you getting,
what don't you understand.

do not answer the last, until you have cut and pasted the answers for items 1 and 2.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 09, 2012 7:23 pm    Post subject:
Reply with quote

one way would on the

sort 201,?,CH,A

inrec side,

parse %=STARTAFT=C'|'),
%00=STARTAFT=C'|',ENDBEFR='|',fixlen=?
build=1,200,%01

outrec side
build=1,200

? is what ever maxlength you want the customer number to be.

have to jazz-up the syntax.
the purpose of the % is to start the parse pointer,%00 points to the customer number.
read thru Bill Woodgar's posts, he posted a lot of good info about this
very subject (that you would have found, had you looked) last week or so.
Back to top
View user's profile Send private message
vishalbshah

New User


Joined: 01 Dec 2006
Posts: 61
Location: Pune

PostPosted: Wed May 09, 2012 7:30 pm    Post subject:
Reply with quote

Hi,

I am using the "PARSE" very first time , the example I am looking in the manual provide a way to produce a file with fixed positions , but i don't want to produce a different file layout all I want is the input file should be sorted on base of customer number and i am unsure about it's position in each record.

I know only the variable file layout which is "|" "name" "|" "customer number"

input :

Code:

|VISHALBSHAH|#_1100000001        0000LGL           
|KHUDDAM-UL-ISLAM|#_0510000001        0001AKA     
|BUBLOO|#_0510000001        0002AKA               
|BABOO|#_0510000001        0003AKA                 
|VICKYBSHAH|#_1100000001        0001AKA           
|VICKYBSHAH|#_1100000002        0000LGL           
|VICKYBSHAH|#_1100000002        0001AKA           


I need to sort this based on customer number

I am trying to follow manual here which suggest I can remove the 1st and second "|" with (%=(ENDBEFR=C'|') but I am not sure what should i write in the SORT FIELDS as I am not sure about the position of the customer number, as it varies from record to record.

I need output file as:

Code:


|KHUDDAM-UL-ISLAM|#_0510000001        0001AKA       
|BUBLOO|#_0510000001        0002AKA                 
|BABOO|#_0510000001        0003AKA                   
|VISHALBSHAH|#_1100000001        0000LGL             
|VICKYBSHAH|#_1100000001        0001AKA             
|VICKYBSHAH|#_1100000002        0000LGL             
|VICKYBSHAH|#_1100000002        0001AKA             


Could you please,suggest?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 09, 2012 7:37 pm    Post subject:
Reply with quote

read the post immediately above your last.

i told you how to do it.

hey, this is syncsort forum.
there is no Frank or Kolusu here to do your work for you.
Back to top
View user's profile Send private message
vishalbshah

New User


Joined: 01 Dec 2006
Posts: 61
Location: Pune

PostPosted: Wed May 09, 2012 7:47 pm    Post subject:
Reply with quote

Tried and worked !

Code:


//TCSVBSTS JOB 0000,'VARSORT1',CLASS=7,MSGCLASS=U,           
//    NOTIFY=&SYSUID,MSGLEVEL=(1,1)                           
//* $ACFJ219 ACF2 ACTIVE I003                                 
//SORT10   EXEC PGM=SORT                                     
//SORTIN   DD DSN=TCS.TEST.VISHAL.GNR.LOAD,DISP=SHR           
//SORTOUT  DD DSN=TCS.TEST.SORT.VISHAL.GNR.LOAD,             
//           DISP=SHR                                         
//SYSOUT   DD   SYSOUT=*                                     
//SYSOUZ   DD   SYSOUT=*                                     
//SORTWK01 DD   SPACE=(TRK,(1,1))                             
//SYSIN    DD *                                               
  SORT FIELDS=(201,12,CH,A)                                   
  INREC PARSE=(%=(STARTAFT=C'|'),                             
               %01=(STARTAFT=C'|',ENDBEFR=C' ',FIXLEN=12)),   
        BUILD=(1,200,%01)                                     
  OUTREC BUILD=(1,200)                                       
/*                                                           


Thanks a lot !
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 09, 2012 7:56 pm    Post subject:
Reply with quote

glad you were able to accomplish your task.

by the way,,,,,,
Quote:
Code:
TCS.TEST.SORT.VISHAL.GNR.LOAD

odd naming convention for a data file.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed May 09, 2012 8:12 pm    Post subject:
Reply with quote

Try below mentioned SORT card(Note: I used DFSORT)

Code:
//STEP01  EXEC PGM=SORT                                   
//SYSPRINT  DD SYSOUT=*                                   
//SYSOUT    DD SYSOUT=*                                   
//SORTIN    DD *                                           
|VISHALBSHAH|#_1100000001        0000LGL                   
|KHUDDAM-UL-ISLAM|#_0510000001        0001AKA             
|BUBLOO|#_0510000001        0002AKA                       
|BABOO|#_0510000001        0003AKA                         
|VICKYBSHAH|#_1100000001        0001AKA                   
|VICKYBSHAH|#_1100000002        0000LGL                   
|VICKYBSHAH|#_1100000002        0001AKA                   
/*                                                         
//SORTOUT   DD SYSOUT=*                                   
//SYSIN  DD  *                                             
 SORT FIELDS=(01,50,CH,A)                                 
 INREC IFTHEN=(WHEN=INIT,                                 
       PARSE=(%01=(ENDBEFR=C'|',FIXLEN=1),                 
              %02=(ENDBEFR=C'|',FIXLEN=30),               
              %03=(STARTAFT=C'#',FIXLEN=50)),   
       BUILD=(%03,51:1,80))                     
 OUTREC FIELDS=(1:51,80)                       
/*       


Output:


Code:
|KHUDDAM-UL-ISLAM|#_0510000001        0001AKA           
|BUBLOO|#_0510000001        0002AKA                     
|BABOO|#_0510000001        0003AKA                     
|VISHALBSHAH|#_1100000001        0000LGL               
|VICKYBSHAH|#_1100000001        0001AKA                 
|VICKYBSHAH|#_1100000002        0000LGL                 
|VICKYBSHAH|#_1100000002        0001AKA         
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 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 CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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