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

Issue with SYMBOLS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sun Nov 25, 2012 5:26 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Nov 25, 2012 6:05 pm
Reply with quote

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
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sun Nov 25, 2012 6:11 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Nov 25, 2012 6:27 pm
Reply with quote

The "length" of what?
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sun Nov 25, 2012 6:34 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Nov 25, 2012 7:59 pm
Reply with quote

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
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Mon Nov 26, 2012 11:09 pm
Reply with quote

I defined another SYMBOL BSLEN1,1,10562 and used in the places where there is an error. It worked fine.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 26, 2012 11:22 pm
Reply with quote

Code:
BSLEN1,1,10562


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
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Mon Nov 26, 2012 11:35 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2012 2:17 am
Reply with quote

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
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Tue Nov 27, 2012 9:14 am
Reply with quote

Thanks Bill. It worked fine and I could also some improvement in Elapsed Time.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2012 1:25 pm
Reply with quote

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
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Tue Nov 27, 2012 1:38 pm
Reply with quote

Yes input files are in Key order
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2012 1:40 pm
Reply with quote

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
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Tue Nov 27, 2012 1:53 pm
Reply with quote

Having tried SORTED with JOINKEYS, it had further improved the performance.

Thanks for the help.
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 XML Generate issue COBOL Programming 0
No new posts How to Login in to cics region and is... CICS 9
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts JCL Dynamic System Symbols JCL & VSAM 3
Search our Forums:

Back to Top