How to pass system date stored in a PDS member to symbolic ?

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
chanakya
Member
Posts: 21
Joined: Thu Aug 18, 2011 7:34 pm

How to pass system date stored in a PDS member to symbolic ?

Post by chanakya » Wed Oct 05, 2011 7:34 pm

I have to read the date from the ps file or any member of pds file which has the date in the following format yyyymmdd.

how can I use this date in place of current date as symbolic in the jcl.


OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
INCLUDE=(INC1,EQ,C'B',AND,(BLD4,BI,EQ,BLD3,BI)),
BUILD=(RFFLD),
TRAILER1=(DATE,COUNT=(M10,LENGTH=8))


ALL suggesstions are obviously welcome. I probably would want to stay with JCL

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Oct 05, 2011 8:50 pm

Read the file and write the sort control statements into a file for subsequent use in the sort step. The sort control statements will no longer be inline.

I know of no way to get data from a dataset into some control statement via a "symbolic" (which is a jcl function, not a data file function).
Have a good one

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Oct 05, 2011 10:09 pm

Chanakya,

You can use a DFSORT job something like this. S1 creates symbol MYDATE in file &&S1. S2 concatenates &&S1 to your SYMNAMES data set so MYDATE can be used.

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  file or member with yyyymmdd in positions 1-8
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(C'MYDATE,''',1,8,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYMNAMES DD DSN=...  symbol data set
// DD DSN=&&S1,DISP=(OLD,PASS)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//OUT DD DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
   INCLUDE=(INC1,EQ,C'B',AND,(BLD4,BI,EQ,BLD3,BI)),
   BUILD=(RFFLD),
   TRAILER1=(MYDATE,COUNT=(M10,LENGTH=5))
/*
Last edited by Frank Yaeger on Fri Oct 07, 2011 10:11 pm, edited 1 time in total.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

chanakya
Member
Posts: 21
Joined: Thu Aug 18, 2011 7:34 pm

Post by chanakya » Fri Oct 07, 2011 6:50 pm

Hi Frank,

Thank you very much!! It is working as expected.

Could you please help me to understand below code's working?
Frank Yaeger wrote:Chanakya,

Code: Select all

  INREC BUILD=(C'MYDATE,''',1,8,C'''',80:X)

Can you explain how it is working?
Especially (,''',) and (C'''',80:X)

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Oct 07, 2011 9:45 pm

When you want to use an apostrophe within 'string', you have to code two apostrophes.

C'MYDATE,''',1,8,C'''',80:X

Breaking it down, you get:

MYDATE,'string',80:X

MYDATE is the symbol name.
'string' is the date constant.
80:X tells DFSORT to put blanks up to column 80 (easy way to set the record length to 80).

So for example, if you have 20110518 in positions 1,8, INREC will build the following 80-byte symbol statement:

MYDATE,'20110518'

You can then use MYDATE in SYMNAMES as a symbol for '20110518'.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others