How to fetch and compare the system date in JCL

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
vijay_10b
Member
Posts: 9
Joined: Tue Sep 04, 2012 4:41 pm

How to fetch and compare the system date in JCL

Post by vijay_10b » Wed Sep 05, 2012 2:54 pm

Hi,

Can some one help me on this....I need to fetch the system date and sort the PS record matching with system date.................i used the following method but getting o/p blank............date in PS record in the format yyyymmdd ........... if i can get yymmdd also fine

Code: Select all

//xxxxx JOB (234),'TEST',CLASS=A,NOTIFY=&SYSUID                  
//STEP1   EXEC PGM=SORT                                             
//SYSNAMES DD  *                                                    
CURDAT,S'&DAY.&MON.&YR2'                                            
//SORTIN  DD   DSN=xxxx.TRNG.PS,DISP=SHR                         
//SORTOUT DD   DSN=xxxx.TRNG.PSTEST,DISP=(NEW,CATLG,DELETE),     
//             SPACE=(CYL,(4,2)),DCB=(LRECL=40,BLKSIZE=400,RECFM=FB,
//             DSORG=PS)                                            
//SYSOUT  DD   SYSOUT=*                                             
//SYSIN   DD   *                                                    
      SORT FIELDS=COPY                                              
      INCLUDE COND=(12,8,CH,LE,C'CURDAT')                           
      OUTREC FIELDS=(1,8,2X,10,8)                                   
/*
PS record format

Code: Select all

000100 xxxxxxx 20120830  xxxxxxx   xx
000200 xxxxxx   20120906  xxxxxx    xx
000300 xxxxxx   20120905  xxxx        xx
000400 xxxxxx   20120824  xxxxxx    xx

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Sep 05, 2012 3:04 pm

if the format of the date in the file is yyyymmdd
why are you building your compare as: CURDAT,S'&DAY.&MON.&YR2'

had you bothered to look at the output of your sort
(the part that details what sort is doing)
you would have seen what was being created
and maybe you would have not embarrassed yourself with such a silly post.

oh yeah, welcome to the forum. nice start!
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Wed Sep 05, 2012 4:22 pm

Mmmmm... SYSNAMES is interesting. I saw someone(!) suggesting that by accident the other day :-)

Should be SYMNAMES.

Give yourself a //SYMNOUT DD SYSOUT=* as well.

Not much point in testing for a literal, C'CURDAT'.

Look at your output, as dbz suggested, and it least get it somewhere close before getting stuck with it.

If you copied this originally from the internet, you should have read on a bit :-)

User avatar
Gurugars
Active Member
Posts: 107
Joined: Sat Oct 23, 2010 2:17 pm
Location: Chennai,India.

Post by Gurugars » Wed Sep 05, 2012 4:34 pm

Vijay -

Welcome to the forum.

As Dick said have you bothered about the date format you built?

You are building a date format as DDMMYY, but comparing with the date format YYMMDD (as you mentioned in your post)

Also check your Control card

Code: Select all

SORT FIELDS=COPY
INCLUDE COND=(12,8,CH,LE,C'CURDAT')
OUTREC FIELDS=(1,8,2X,10,8)
/*

You are comparing the with the character 'CURDAT'. That should be simply CURDAT instead of C'CURDAT'.
Guru:-)

You're never fully dressed without a smile :)

vijay_10b
Member
Posts: 9
Joined: Tue Sep 04, 2012 4:41 pm

How to fetch and compare the system date

Post by vijay_10b » Wed Sep 05, 2012 5:28 pm

I referred few examples in Google search ..........and using
//SYSNAMES DD *
CURDAT,S'&YR2.&MON.&DAY'

is this a valid jcl statement? because i'm not getting any error.

And as per ur suggestion i changed the format of CURDAT and for
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(12,8,CH,LE,CURDAT)
OUTREC FIELDS=(1,8,2X,10,Cool
/*

When i prep i'm getting error
.JCPA JCP0482E WER268A INCLUDE STATEMENT : SYNTAX ERROR -- (J)10
JCLPREP CC 8

Can you please suggest me the correct format or utility

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Wed Sep 05, 2012 5:38 pm

Well,

Code: Select all

//SYSNAMES DD * 
is valid JCL.

Not much help to you, though, as the SORT program knows nothing about it.

SYMNAMES is known to the SORT program.

Funny how a slip of the keyboad and it's all over the internet and bites on another board... wasn't me, by the way :-)

I've no idea what you are attempting with your OUTREC, which is invalid.

Why use a dumb jclchecker. Why not just run it?

vijay_10b
Member
Posts: 9
Joined: Tue Sep 04, 2012 4:41 pm

How to fetch and compare the system date

Post by vijay_10b » Wed Sep 05, 2012 5:47 pm

Then can you please suggest me how to compare the PS records with system/current date..............so i can sort the PS records based on the system/current date ........................

or any other utility to do above task...............

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Sep 05, 2012 6:44 pm

other than mention the original requirement was stated as:
I need to fetch the system date and sort the PS record matching with system
why sort them if they are all matching the system date?

yet the INCLUDE is for LE, which means he does not want to include any records from tomorrow.

William, you can keep repeating what you have said until that sinks in,
and then you can work on the problem of what records the TS actually wants to keep.

i would answer this question:
or any other utility to do above task
with
assign a different person to the task.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

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

Post by DikDude » Wed Sep 05, 2012 8:02 pm

Then can you please suggest me how to compare the PS records with system/current date..............
Correct your sort control statements and it should work.

You insist on SYSNAMES but this is not supported by the sort. You can add all of the DD statements you want to a job and they will have almost no impcat - they just will not be used as input/output if the progrm does not know of them.

Rearrange the order of the data you retrieve from the system to the format you need - not something you copied from some other question/solution.
Last edited by DikDude on Wed Sep 05, 2012 9:08 pm, edited 1 time in total.
Have a good one

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Wed Sep 05, 2012 9:04 pm

Your question has next to nothing to do with JCL - apart from the fact that you do not seem to understand JCL. It is mostly to do with SORT and SYNCSORT in particular. So...why did you post in the JCL part of the forum instead of the Sort part of the forum - the one immediately underneath the JCL section.

Your JCL problem can be resolved by looking at the JCL requirements of SYNCSORT in the SYNCSORT manual - and possibly some of your other problems, too.
Regards
Nic

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

Post by DikDude » Wed Sep 05, 2012 9:13 pm

Thanks Nic - i forget which sort topics go "where" on the different forums :oops:

Topic moved to the sort part of the forum.

d

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Thu Sep 06, 2012 5:44 pm

vijay_10b - please learn to use the BBCode Tags. I've edited your post to add them. However, "PS record format", from your post does not seem to be aligned well.

OTOH, I don't understand what are you asking. You said
need to fetch the system date and sort the PS record matching with system date
- but you show SORT statements using INCLUDE only those records which are less than current date. Perhaps, an example of input records along with expected output would be nice.
Regards,
Anuj

vijay_10b
Member
Posts: 9
Joined: Tue Sep 04, 2012 4:41 pm

How to fetch and compare the system date in JCL

Post by vijay_10b » Fri Sep 07, 2012 9:12 pm

Ty for ur critics and view..................got the solution

//ANO03364 JOB (234),'TEST',CLASS=A,NOTIFY=&SYSUID
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=ANO0336.TRNG.PS,DISP=SHR
//SORTOUT DD DSN=ANO0336.TRNG.PSTEST,DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(4,2)),DCB=(LRECL=40,BLKSIZE=400,RECFM=FB,
// DSORG=PS)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(12,6,Y2T,LE,Y'DATE1')
OUTREC BUILD=(1,8,2X,10,8)
/*

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

Post by DikDude » Fri Sep 07, 2012 9:43 pm

Great to hear it is working and thank you for the update :)

However, it is extremely unprofessional to use "chat room" or "texting" speak when posting on a technical forum.
Have a good one

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 9:52 pm

<< Content deleted By Admin >>

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