|
View previous topic :: View next topic
|
| Author |
Message |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
I'm actually trying to extract certain fileds from each record of an Input file which has header, Body and the trailor record.
Im using the Outrec functionality to do this, which is working pretty much fine....
The problem is, The output record should contain the fields extracted from the input record, but along with that I also need a field from the header record to be appended at the end of each record...
For example....
I/P
UHL1 11223999999 000000001 DAILY 001 ------> Header
0901260484747901760131941465016 0000001
2011138047179801760131941465016 0000000
I want the o/p to be
09012604,8474790176,013194,1465016,11223999999
20111380,4717980176,013194,1465016,11223999999
all the fields above are same except 11223999999 which shld come from the header file to each record..... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you look at the output messages from any old sort job that you have lying around, and just let us know what they start with. Even better, do you (reliably) know which sort product you have?
Won't make a big different to the solution, but you might be in the right, or the wrong, forum. Just checking. |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
Im not sure about the exact product... But my JCL looks step like this
//STEP030 EXEC PGM=SORT,PARM='SIZE=102400' |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| narasimha.g wrote: |
Im not sure about the exact product... But my JCL looks step like this
//STEP030 EXEC PGM=SORT,PARM='SIZE=102400' |
Look at SYSOUT messages..
if you get ICE* messages then you have DFSORT
if you get WER* messages then you have SYNCSORT... |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| @ Escapa - thanks for that.... We have SYNCSORT here..... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Well, I wish I'd asked that question. At least we know you are in the right place now, no late surprises with that. |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| is this impossible to do using a JCL???? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, this is impossible to do with JCL.
It is possible with SORT, but SORT isn't JCL. SORT is a program. JCL runs programs and attaches the resources a program needs to the actually existing bits lying around here and there.
If you are just patient and nice, one of the SORT Wizards will probably come up with something for you.
If you are impatient, you may have to look elsewhere.
While waiting, how about digging up a manual and having a look yourself? Good way to pick up something along the way. |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| Thanks Bill.... ya i am doing it.... Ll try something else would write a cobol program to accomplish it.... or an Easytrieve program in the jcl SYSIN might also work.... not sure.... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Easytrieve would be, well, easy.
Any chance of going to the program that created the file and doing it there? That would be easiest of all.
SORT can do it. If you prefer Easytrieve, let us know. Maybe that is a way to light a fire under the Sort Wizards? |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
narasimha.g,
Here's a Syncsort job which would work for the example given.
I have assumed 'UHL' at pos-1 for the header record and that you do not need the header to be written into the output as shown in your example. The below sort assumes the input to be of FB/LRECL=80 and can be modified as per your real file attributes
| Code: |
//STEP01B EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
UHL1 11223999999 000000001 DAILY 001 ------> HEADER
0901260484747901760131941465016 0000001
2011138047179801760131941465016 0000000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),
PUSH=(81:6,11)),
IFTHEN=(WHEN=INIT,
BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',81,11))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,3,CH,NE,C'UHL') |
SORTOUT had
| Code: |
09012604,8474790176,013194,1465016,11223999999
20111380,4717980176,013194,1465016,11223999999 |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
narasimha.g,
You excluded the header (and trailer) in your sample output. You should be able to cope with excluding the trailer from the cards shown, and to include both without amendments if that is what you actually want. |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| Arun Raj wrote: |
narasimha.g,
Here's a Syncsort job which would work for the example given.
I have assumed 'UHL' at pos-1 for the header record and that you do not need the header to be written into the output as shown in your example. The below sort assumes the input to be of FB/LRECL=80 and can be modified as per your real file attributes
| Code: |
//STEP01B EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
UHL1 11223999999 000000001 DAILY 001 ------> HEADER
0901260484747901760131941465016 0000001
2011138047179801760131941465016 0000000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),
PUSH=(81:6,11)),
IFTHEN=(WHEN=INIT,
BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',81,11))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,3,CH,NE,C'UHL') |
SORTOUT had
| Code: |
09012604,8474790176,013194,1465016,11223999999
20111380,4717980176,013194,1465016,11223999999 |
|
thanks very much arun....
My input file LRECL = 100... and hence i changed the code as follows
| Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),
PUSH=(101:6,11)),
IFTHEN=(WHEN=INIT,
BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',101,11)) |
is it correct???? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Did you test it????
Or
Yes, looks fine. Whack it into Production please. Just make sure the sign-off is indecipherable. |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| Bill Woodger wrote: |
Did you test it????
Or
Yes, looks fine. Whack it into Production please. Just make sure the sign-off is indecipherable. |
i did check that but its abending... im sure it is because of the LRECL problem....
i actual scenario my input file is of 100 length and output would be LRECL 82 |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And what do you want in the remaining bytes up to 82?
Is the file VB are FB?
What do you have as your SORTOUT? |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
im getting the below error...
SYSIN :
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'UHL'),
*
PUSH=(81:6,11)),
IFTHEN=(WHEN=INIT,
BUILD=(1,8,C',',9,10,C',',19,6,C',',25,7,C',',81,11))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1,3,CH,NE,C'UHL')
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
is it that it doesn support the functionality???? wht can be done now???? |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| Bill Woodger wrote: |
And what do you want in the remaining bytes up to 82?
Is the file VB are FB?
What do you have as your SORTOUT? |
The example which i gave there was just a sample.... i have an input of lenght 100... i would be seleting more fields than i mentioned before..... but at end i need the field from the header to be appended.....
It is a FB file... and my SORTOUT is a FB dataset LRECL 82 |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Maybe your SYNCSORT is not up-to-date? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
S-SAVE-HDR-VALUE S 11 A
JOB +
INPUT INFILE
IF INFILE-HDR-INDICATOR EQ "HDR"
S-SAVE-HDR-VALUE = INFILE-HDR-VALUE
GO TO JOB
END-IF
IF INFILE-TRL-INDICATOR EQ "TRL"
GO TO JOB
END-IF
* other stuff here for creating output record
OUTFILE-HDR-VALUE = S-SAVE-HDR-VALUE
OUTFILE : RECORD-LENGTH = 82
PUT OUTFILE |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| narasimha.g wrote: |
| is it that it doesn support the functionality???? wht can be done now???? |
narasimha.g,
Are your sort control statements starting at pos-1?. From your error messages it looks so. It should be started from pos-2 or greater.
btw, which syncsort version are you running? AFAIK GROUP function is supported since Syncsort 1.3.2 |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Looks so, because, as usual, not "coded". Click "quote" and spacing looks OK. |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| Arun Raj wrote: |
| narasimha.g wrote: |
| is it that it doesn support the functionality???? wht can be done now???? |
narasimha.g,
Are your sort control statements starting at pos-1?. From your error messages it looks so. It should be started from pos-2 or greater.
btw, which syncsort version are you running? AFAIK GROUP function is supported since Syncsort 1.3.2 |
im not sure abt the SYNC sort verion we are using... might be its not up to date..... i wrote a cobol program finally to accomplish that....  |
|
| Back to top |
|
 |
narasimha.g
New User
Joined: 10 Sep 2009 Posts: 68 Location: Liverpool
|
|
|
|
| Bill Woodger wrote: |
| Looks so, because, as usual, not "coded". Click "quote" and spacing looks OK. |
Thanks Bill for the Help....  |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| im not sure abt the SYNC sort verion we are using |
Good that you have figured it out yourself. btw the Syncsort version info will be there on the top of the SYSOUT from any run. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|