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

Symbolic variables in SORT output


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Richard J

New User


Joined: 27 Mar 2009
Posts: 13
Location: London, UK

PostPosted: Wed Jul 01, 2009 9:58 pm
Reply with quote

Hi everyone,

Does anybody know how I can get a symbolic variable into an SORTs output file please?

In my JCL I have a symbolic variable set as...
Code:
DATE='01.07.2009'


...and then some JCL creating a report as shown below. I am hoping to find a way to insert the DATE value above into TRAILER1 where it says 'Date value here'. Can anybody point me the right way please? (I've removed the extra bits from the jcl for readability)

Code:

//SORT     EXEC PGM=SORT,COND=(4,LT)
//SYSOUT   DD   SYSOUT=*
//SORTIN   DD   DSN=<Input file>,DISP=SHR,LRECL=80
//REPOUT   DD   DSN=<Output file>,DISP=(NEW,CATLG),
//         SPACE=(20,(500,100),RLSE),AVGREC=U,
//         LRECL=75,RECFM=FBA
//SYSIN    DD   *
 SORT FIELDS=<some sort conditions>,
 SKIPREC=1
 SUM FIELDS=NONE
 OUTFIL FNAMES=REPOUT, REMOVECC,
 OUTREC=(1:1,9,15:57,10,28:47,9,40:11,35),LINES=5,
 HEADER2=(1:<various report header records>'),
 TRAILER1=(1:'END OF REPORT', 30:Date value here),
 TRAILER2=(1:' ')


Many thanks for your help.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 01, 2009 11:25 pm
Reply with quote

Richard,

Is the date value different from current date or an offset from current date?

DFSORT does have the capability of putting the current date and an offset to current date (current date + 7 or current date - 7)

If it is some other date then you can follow the example listed here

www.ibmmainframes.com/viewtopic.php?p=193544#193544
Back to top
View user's profile Send private message
Richard J

New User


Joined: 27 Mar 2009
Posts: 13
Location: London, UK

PostPosted: Thu Jul 02, 2009 1:36 pm
Reply with quote

Hi Skolusu.

Thankyou for your reply. I've had a read of your link and it looks like exactly the thing I need. I will give it a go today and post my results.

In answer to your question I will be using an offset of the current date, but this has the potential to change on a whim so having the ability to pass in a variable may be better than hard coding a 'give me today +1' into the sort. That said, it's a good fall back option if I can't get the other method to work.

Thankyou.
Back to top
View user's profile Send private message
Richard J

New User


Joined: 27 Mar 2009
Posts: 13
Location: London, UK

PostPosted: Thu Jul 02, 2009 3:36 pm
Reply with quote

I have spent some time trying out your suggestions Skolusu with mixed results.
The link you provided is superd and I have managed to find another use for it, unfortunately I have misunderstood how I am using the symbolic variables we have set up in my existing problem... on to plan B.

I have attempted to find out how to incorporate a date into the output as per your second suggestion but am running into difficulties understanding the examples in the documentation we have.

If I am using the below SYSIN to format the output, how can I insert a DATE1(.)+1 date value into the header only at position 50 please? I have tried various combinations and none seem to be hitting the mark.

Code:
SORT FIELDS=(63,4,CH,A,60,2,CH,A,57,2,CH,A,1,9,CH,A,47,9,CH,A),
SKIPREC=1
SUM FIELDS=NONE
OUTFIL FNAMES=REPOUT, REMOVECC
OUTREC=(1:1,9,15:57,10,28:47,9,40:11,35),
HEADER2=(1:'PMSMD28             ',
         22:'REPORT TITLE IS HERE  ',
         50:&DATE1(.)+1,60:'              ',/,
1:'COLUMN ONE ',15:'COLUMN TWO',28:'COLUMN THR',
40:'COLUMN NUMBER FOUR    ',/,
1:'------------',15:'----------',28:'----------',
40:'------------------------------'),
TRAILER1=(1:'END OF REPORT'),
TRAILER2=(1:' '),


Thankyou again for your help.
Rich
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 02, 2009 9:00 pm
Reply with quote

Richard,

Here is the complete JCL showing both methods

Code:

//RICHPROC PROC MYDATE=' '                           
//STEP0100 EXEC PGM=IKJEFT01,PARM='%RICHSYM &MYDATE'
//SYSTSPRT DD SYSOUT=*                               
//SYSPRINT DD SYSOUT=*                               
//SYSTSIN  DD DUMMY                                 
//SYSEXEC  DD DSN=RICHARD.ANY.PDS,DISP=SHR         
//OUTDD    DD DSN=RICARD.SYM,DISP=(,PASS),           
//            SPACE=(TRK,(1,0),RLSE),               
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) 
//*                                                 
//STEP0200 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SYMNAMES DD DSN=RICHARD.SYM,DISP=SHR                       
//SORTIN   DD DSN=Your input file,DISP=SHR                   
//REPOUT   DD SYSOUT=*                               
//SYSIN    DD DSN=RICHARD.PARM(SORTCARD),         
//            DISP=SHR                               
// PEND                                             
//GO       EXEC RICHPROC,MYDATE='2000.01.01'         



RICHSYM rexx exec

Code:

/* REXX */                                     
"ALLOC FI(OUTDD) DA('RICHARD.sym') SHR REUSE"   
PULL ARG                                       
QUEUE 'SYM1,C'''||ARG(1)||''''                 
"EXECIO 1 DISKW OUTDD (FINIS"                 
"FREE FI(OUTDD)"                               


RICHARD.PARM(SORTCARD) has the following
Code:

  OPTION SKIPREC=1                                               
  SORT FIELDS=(63,4,CH,A,60,2,CH,A,57,2,CH,A,1,9,CH,A,47,9,CH,A)
  SUM FIELDS=NONE                                               
  OUTFIL FNAMES=REPOUT,REMOVECC,                                 
  OUTREC=(1:1,9,15:57,10,28:47,9,40:11,35),                     
  HEADER2=(01:'PMSMD28            ',                             
           22:'REPORT TITLE IS HERE  ',                         
           50:SYM1,60:'              ',/,                       
           01:'COLUMN ONE ',15:'COLUMN TWO',28:'COLUMN THR',     
           40:'COLUMN NUMBER FOUR    ',/,                       
           01:'------------',15:'----------',28:'----------',   
           40:'------------------------------'),                 
  TRAILER2=(1:' '),                                             
  TRAILER1=(1:'END OF REPORT')                                   



If you want the current date +/- offset then use the following control cards. This will put the current date + 1 day in CCYY.MM.DD format on the header.

Code:

//SYSIN    DD *                                                   
  OPTION SKIPREC=1                                               
  SORT FIELDS=(63,4,CH,A,60,2,CH,A,57,2,CH,A,1,9,CH,A,47,9,CH,A) 
  SUM FIELDS=NONE                                                 
  OUTREC BUILD=(1:1,9,15:57,10,28:47,9,40:11,35,DATE1(.)+1)       
  OUTFIL FNAMES=REPOUT,REMOVECC,BUILD=(1,74),                     
  HEADER2=(01:'PMSMD28            ',                             
           22:'REPORT TITLE IS HERE  ',                           
           50:75,10,60:'              ',/,                       
           01:'COLUMN ONE ',15:'COLUMN TWO',28:'COLUMN THR',     
           40:'COLUMN NUMBER FOUR    ',/,                         
           01:'------------',15:'----------',28:'----------',     
           40:'------------------------------'),                 
  TRAILER2=(1:' '),                                               
  TRAILER1=(1:'END OF REPORT')                                   
Back to top
View user's profile Send private message
Richard J

New User


Joined: 27 Mar 2009
Posts: 13
Location: London, UK

PostPosted: Thu Jul 02, 2009 10:44 pm
Reply with quote

Fantastic!
I will incorprate both of your suggestions first thing tomorrow... two different problems solved with one solution!

Thankyou for all your help Skolusu.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top