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

Sorting Pipe separated file using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top