View previous topic :: View next topic
|
Author |
Message |
vishalbshah
New User
Joined: 01 Dec 2006 Posts: 61 Location: Pune
|
|
|
|
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 |
|
|
vishalbshah
New User
Joined: 01 Dec 2006 Posts: 61 Location: Pune
|
|
|
|
Sorry a TYPO
I am using ENDBEFR not "ENDBFER" |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
ENDBEFR? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
vishalbshah
New User
Joined: 01 Dec 2006 Posts: 61 Location: Pune
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
vishalbshah
New User
Joined: 01 Dec 2006 Posts: 61 Location: Pune
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
vishalbshah
New User
Joined: 01 Dec 2006 Posts: 61 Location: Pune
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
|
|