Computing DATE in JCL



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Computing DATE in JCL

Postby naggarwal6 » Thu Dec 27, 2012 9:43 pm

Hey All,
I want to check if a specific-date(from input file) falls in the last-month or not ? I have to do all this in a JCL only as I am using this condition in a JCL only. I need the value of 30 day old date in a variable so that it can get its value on run-time thru system date. How can i get this date from system-date ?

Thanks in Advance
Navdeep
naggarwal6
 
Posts: 10
Joined: Thu Dec 27, 2012 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Computing DATE in JCL

 

Re: Computing DATE in JCL

Postby Akatsukami » Thu Dec 27, 2012 9:49 pm

JCL has no facilities for computing date differences or anything else, so you are out of luck. When you have decided what other tools (*Sort, Rexx, etc.) are acceptable, come back and ask again.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Computing DATE in JCL

Postby steve-myers » Thu Dec 27, 2012 9:51 pm

You have a very confused notion of what JCL can - and cannot - do. The only thing JCL can do is define the environment required to run a program and then run the program. JCL cannot "compute" anything. That's what programs are for.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Computing DATE in JCL

Postby dick scherrer » Thu Dec 27, 2012 9:59 pm

Hello and welcome to the forum,

As you are quickly learning, someone has given you terrible direction/information. Many people who are supposed to "know something" are butchering terminology. One of the worst cases on the mainframe is the mis-use of JCL.

I have to do all this in a JCL only as I am using this condition in a JCL only.
Not correct - you would use some JCL and then some control statements for the program to be executed.

If you post what you have so far, someone may have a usable suggestion.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Computing DATE in JCL

Postby naggarwal6 » Thu Dec 27, 2012 10:55 pm

Hey All,
Thanks for your replies. I believe there has been some wrong interpretation of my words. what i meant is that , i want to do this computation all in the JCL as i need to use the variable (containing the value of 30 day old date) in a JCL condition(to omit records beyond this date).
I tried using SORT,DFSORT for this but not getting how can i use that value in JCL ??

Please let me know, what more info. is required from my side ??

Thanks in Advance
Navdeep
naggarwal6
 
Posts: 10
Joined: Thu Dec 27, 2012 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Computing DATE in JCL

Postby Akatsukami » Thu Dec 27, 2012 11:09 pm

naggarwal6 wrote:Hey All,
Thanks for your replies. I believe there has been some wrong interpretation of my words. what i meant is that , i want to do this computation all in the JCL as i need to use the variable (containing the value of 30 day old date) in a JCL condition(to omit records beyond this date).

To reiterate: JCL cannot do this. Moreover, JCL has no ability to omit records from a data set or a queue, so you are, at a minimum, utterly failing in communicating (and perhaps understanding) what you are trying to do.
Please let me know, what more info. is required from my side ??

Now, you have stated that you have tried to do this and failed. Please paste the JCL and the control cards for DFSORT (or what have you) of the failed attempt(s) enclosed in Code tags.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Computing DATE in JCL

Postby dick scherrer » Thu Dec 27, 2012 11:13 pm

Hello,

Additionally, You also need to post the English description of what you want to accomplish.

Regardless of what you have been told to do, it cannot be done with JCL alone. Once you explain the requirement, we should be able to suggest something that will do what you need.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Computing DATE in JCL

Postby naggarwal6 » Thu Dec 27, 2012 11:35 pm

//DSLOGS  EXEC PGM=ACFRPTSL,REGION=2M                 
//BACKUP  DD DSN=SYS1.ACF.BKLIDS,DISP=SHR             
//SYSPRINT DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE),
//            DCB=(RECFM=VBA,LRECL=255,BLKSIZE=6120),
//            UNIT=DISK,SPACE=(CYL,(90,40),RLSE)     
//SYSOUT DD *                                         
//SYSIN DD *                                         
 INPUT(BKUP)                                         
 MASK(USER-ID)                                       
 REPORT(SHORT)                                       
 SFLDS(CSDATE,SUSPEND)                               
 IF(CSDATE < CYYYYMM  AND SUSPEND)                   
 NOUPDATE                                             
/*   


This is the JCL which I am using. This utility ACFRPTSL is fetching list of IDs from ACF2 and then the statement
IF(CSDATE < CYYYYMM AND SUSPEND)

is the statement where i want to put the 30 day old date to some variable so that I can compare the CSDATE with it and then print my records.
naggarwal6
 
Posts: 10
Joined: Thu Dec 27, 2012 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Computing DATE in JCL

Postby c62ap90 » Fri Dec 28, 2012 12:05 am

I cannot figure out exactly what is needed but this SORT JCL creates a Specific Date or current System Date file that can be used for comparing.
//*-- PURPOSE: CREATE SPECIFIC DATE OR SYSTEM DATE IN FOLLOWING FORMAT: 
//*--    COL...----+----1----+----2                                     
//*--          CDATE,'mm/dd/yy'                                         
//*-- NOTES:   - USE OUTPUT FILE, FOR EXAMPLE, IN SORT INCLUDE           
//*--            INCLUDE COND=(49,8,CH,EQ,CDATE,OR,59,8,CH,EQ,CDATE)     
//*---------------------------------------------------------------------
//*                                                                     
//SORTDATE EXEC PGM=SORT                                                 
//SYSOUT   DD SYSOUT=*                                                   
//SYMNOUT  DD SYSOUT=*                                                   
//SYSPRINT DD SYSOUT=*                                                   
//SYSOUT   DD SYSOUT=*                                                   
//SORTIN   DD *                                                         
01/09/12                                                                 
/*                                                                       
//SORTOUT  DD DSN=XXXXX.XXX.SORTDATE,                                   
//            DISP=(NEW,CATLG,DELETE),                                   
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),                         
//            ...ETC.                                                   
//* ----+----1----+----  SPECIFIC DATE EXAMPLE RUN ON 12/27/2012   
//* CDATE,'01/09/12'                                               
//*                                                                 
//* ----+----1----+----  SYSTEM   DATE EXAMPLE RUN ON 12/27/2012   
//* CDATE,'12/27/12'                                               
//*                                                                 
//*                                                                 
//*--- FOR SPECIFIC DATE, RUN USING THE FOLLOWING SETUP:           
//*--- USE "MM/DD/YY" FORMAT IN THE DD-SORTIN DATE BELOW.           
//*    ----+----1----+----2                                         
//*    //SYSIN    DD *                                             
//*      OPTION COPY                                               
//*      INREC IFTHEN=(WHEN=(1,5,CH,NE,C'CDATE'),                   
//*        BUILD=(C'CDATE,''',1,8,C'''',80:X))                     
//*      OUTFIL ENDREC=1                                           
//*                                                                 
//*--- FOR SYSTEM CURRENT DATE, RUN USING THE FOLLOWING SETUP:     
//*--- IGNORES THE DD-SORTIN DATE.                                 
//*    ----+----1----+----2                                         
//*    //SYSIN    DD *                                             
//*      OPTION COPY                                     
//*      OUTREC BUILD=(C'CDATE,''',&DATE,C'''',80:X)     
//*      OUTFIL ENDREC=1                                 
//SYSIN    DD *                                         
  OPTION COPY                                           
  OUTREC BUILD=(C'CDATE,''',&DATE,C'''',80:X)           
  OUTFIL ENDREC=1                                       
/*                                                       
//
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 6 times

Re: Computing DATE in JCL

Postby Akatsukami » Fri Dec 28, 2012 12:13 am

What you show as significant are ACF2 control cards, not JCL.

Fortunately, the solution is trivial. I recognize that you do not purport Rexx to be amongst your skill, but a similar solution is available using COBOL.

The Rexx script:
/* Rexx */                                                         
/* Written Heisei 24.12.27 by Akatsukami-sama */                   
  trace o                                                           
  sig      = x2c("E69989A3A3859540C88589A2858940F2F44BF1F24BF2F740")
  sig      = sig || x2c("82A840C19281A3A2A49281948960A2819481")     
  since    = substr(date("Standard",date("Base")-30,"Base"),1,6)   
  "ALLOC F(ISPFILE) DA(WORK.CNTL) SHR REU"                         
  address ispexec "LIBDEF ISPSLIB DATASET ID(WORK.SKELS) STACK"     
  address ispexec "FTOPEN"                                         
  address ispexec "FTINCL  FOO6"                                   
  address ispexec "FTCLOSE NAME(MYJCL)"                             
  address ispexec "LIBDEF ISPSLIB"                                 
  "FREE F(ISPFILE)"                                                 

The skeleton:
)DEFAULT )&?![+]                                     
//DSLOGS EXEC PGM=ACFRPTSL,REGION=2M                 
//BACKUP DD DSN=SYS1.ACF.BKLIDS,DISP=SHR             
//SYSPRINT DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=VBA,LRECL=255,BLKSIZE=6120),           
// UNIT=DISK,SPACE=(CYL,(90,40),RLSE)                 
//SYSOUT DD *                                         
//SYSIN DD *                                         
INPUT(BKUP)                                           
MASK(USER-ID)                                         
REPORT(SHORT)                                         
SFLDS(CSDATE,SUSPEND)                                 
IF(CSDATE < C&SINCE AND SUSPEND)                     
NOUPDATE                                             
/*                                                   

Notes:
  • You seem to be seeking, despite your description, data sets from the prior month, not thirty days ago. Be careful.
  • I don't know ACF2, never having worked in a shop that used it. I blindly assume, therefore, that the initial "C" in "CYYYYMM" has some meaning, and that the whole is not just badly formatted.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post