|
View previous topic :: View next topic
|
| Author |
Message |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
Hi,
I am using the following SORT Card
| Code: |
SORT FIELDS=(1,22,CH,A)
SUM FIELDS=NONE
JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,BSLEN)
OUTFIL FNAMES=SORTOUT,REMOVECC,
IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),
BUILD=(1:C'H',23,4,PD,TO=ZD,LENGTH=7,BSLEN:X)),
IFTHEN=(WHEN=(1,3,CH,NE,C'000',AND,1,3,CH,NE,C'999'),
BUILD=(1:1,BSLEN)),
TRAILER1=(C'T',COUNT-1=(M11,LENGTH=8)) |
BSLEN is defined in SYMNAMES as value 10562.
| Code: |
DATA DICTIONARY SYMBOLS SUBSTITUTED :
SORT FIELDS=(1,22,CH,A)
SUM FIELDS=NONE
JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,BSLEN)
*
OUTFIL FNAMES=SORTOUT,REMOVECC,IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),BUILD=(1:C'H',23
4,PD,TO=ZD,LENGTH=7,10562:X)),IFTHEN=(WHEN=(1,3,CH,NE,C'000',AND,1,3,CH,NE,C'99
'),BUILD=(1:1,BSLEN)),TRAILER1=(C'T',COUNT-1=(M11,LENGTH=8))
*
WER268A REFORMAT STATEMENT: SYNTAX ERROR
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
Can any one help with what is wrong with the SYNTAX?
Code'd |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have SyncSort. Please be careful about this, as time has to now be spent moving all your stuff out of the DFSORT forum to here.
Please find out how to use the Code tags and the Preview button. Then use them, always.
What are you trying to do? Why did you think you can include a "constant" in a REFORMAT statement and what was that BUILD supposed to be? |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
| I have to use this control card in many steps, only difference is the Length (that I am trying to use as a constant here) varies. In order to avoid coding mutiple cards, I thought of having one common and using SYMBOLS. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| The "length" of what? |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
Length of the file.
I am pasting the JCL here: -
| Code: |
//PS020 EXEC PGM=SORT
//*
//*
//SYSPRINT DD SYSOUT=&NOPRINT
//SYSOUT DD SYSOUT=&NOPRINT
//SORTJNF2 DD DSN=Input File 2
// DISP=SHR
//SORTJNF1 DD DSN=Input File 1,DISP=SHR
//*
//SORTOUT DD DSN=Output File
// DISP=(NEW,CATLG,DELETE),
// DSORG=PS,
// SPACE=(CYL,(50,50),RLSE),
// RECFM=FB,LRECL=[color=red][b]10562 [/b][/color]
//*
//SYSPRINT DD SYSOUT=&NOPRINT
//SYSOUT DD SYSOUT=&NOPRINT
//SYSUDUMP DD SYSOUT=&DUMP |
The Input File 1 lvaries everytime and it length varies. The output file length should match with that of input file 1. In this particular case, the input file length is 10562. So I want to pass this 10562 in the SORT CARD as a constant.
Code'd, yet again |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You are still not Code'ing your posts. It makes it easier for people to help you if they can see everything lined-up correctly. If you continue to ignore this, you'll probably get less help.
The record-length in Sort doesn't work in the way you think it does.
What you do is place the RDW from your variable input file into position 1 in the output file(s).
| Code: |
| BUILD=(1,4,C'XXXXX',5) |
This will copy the RDW, put five Xs in data-positions 1-5, and follow that with the variable-length intput record (from position 5, in this case, to the end of the current record). Sort will take care of the output record-length from the data that you provide, or the presence of IFOUTLEN.
If you leave the DCB information off the output files, Sort will supply it automatically. |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
| I defined another SYMBOL BSLEN1,1,10562 and used in the places where there is an error. It worked fine. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, if that is what you have coded and you are happy, then fine.
However, again, what do you think the above does?
Have you included
| Code: |
| //SYMNOUT DD SYSOUT=* |
in your JCL?
Can you paste the contents of SYMNOUT and the full sysout from your step, please? |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
SYSOUT
| Code: |
SYSIN :
SORT FIELDS=(1,22,CH,A)
SUM FIELDS=NONE
JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:BSLEN1)
OUTFIL FNAMES=SORTOUT,REMOVECC,
IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),
BUILD=(1:C'H',23,4,PD,TO=ZD,LENGTH=7,BSLEN:X)),
IFTHEN=(WHEN=(1,3,CH,NE,C'000',AND,1,3,CH,NE,C'999'),
BUILD=(1:BSLEN1)),
TRAILER1=(C'T',COUNT-1=(M11,LENGTH=8))
SYMNOUT
[code]****** SYMNAMES SYMBOL STATEMENTS ******
BSLEN,10562
BSLEN1,1,10562
********** SYMBOL DEFINITIONS **********
BSLEN,10562
BSLEN1,1,10562 [/code]
DATA DICTIONARY SYMBOLS SUBSTITUTED :
SORT FIELDS=(1,22,CH,A)
SUM FIELDS=NONE
JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:1,10562)
OUTFIL FNAMES=SORTOUT,REMOVECC,IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),BUILD=(1:C'H',23,
4,PD,TO=ZD,LENGTH=7,10562:X)),IFTHEN=(WHEN=(1,3,CH,NE,C'000',AND,1,3,CH,NE,C'999
'),BUILD=(1:1,10562)),TRAILER1=(C'T',COUNT-1=(M11,LENGTH=8)) |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You're getting File 2 records which match on File 1.
F2-INPUT-RECORD,1,10562,CH
F2-INPUT-RECORD-LAST-BYTE,10562,1,CH
| Code: |
JOINKEYS FILES=F1,FIELDS=(1,22,A)
JOINKEYS FILES=F2,FIELDS=(1,22,A)
REFORMAT FIELDS=(F2:F2-INPUT-RECORD)
OUTFIL FNAMES=SORTOUT,REMOVECC,
IFTHEN=(WHEN=(1,3,CH,EQ,C'000'),
OVERLAY=(1:C'H',23,4,PD,TO=ZD,LENGTH=7)),
TRAILER1=(C'T',COUNT-1=(M11,LENGTH=8))
MERGE FIELDS=(1,22,CH,A)
SUM FIELDS=NONE
|
If you input records are 10562, then the above should do you. For the "header" you are creating, just OVERLAY what you want, unless you have a need to blank the rest of record, in which case
| Code: |
| OVERLAY=(1:C'H',23,4,PD,TO=ZD,LENGTH=7,F2-INPUT-RECORD-LAST-BYTE:X)), |
For the non 000 records, you have the entire record already sitting there, so no need to BUILD anything (as you're not changing anything).
You are putting a TRAILER1 trailer on, but leaving the 999 record, I assume that is what you want.
It doesn't matter where you physically put the SORT and SUM, they will operate after the JOINKEYS has run. Since your file is then in key order, no need to sort it again. |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
| Thanks Bill. It worked fine and I could also some improvement in Elapsed Time. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, it's is doing one fewer sorts, and not having to do one 10k move per all data records.
Are your input files in key order? |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
| Yes input files are in Key order |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| So, if you attach ",SORTED" to each of your JOINKEYS, you'll get rid of two more sorts, with further improvement in cpu/elapsed time. |
|
| Back to top |
|
 |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
Having tried SORTED with JOINKEYS, it had further improved the performance.
Thanks for the help. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|