Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

How to fetch and compare the system date in JCL

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
vijay_10b
Member


Joined: 04 Sep 2012
Posts: 9

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Wed Sep 05, 2012 2:54 pm    Post subject: How to fetch and compare the system date in JCL Reply with quote

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:
//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:
000100 xxxxxxx 20120830  xxxxxxx   xx
000200 xxxxxx   20120906  xxxxxx    xx
000300 xxxxxx   20120905  xxxx        xx
000400 xxxxxx   20120824  xxxxxx    xx
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

dbzTHEdinosauer
Moderator


Joined: 02 Oct 2006
Posts: 981

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Wed Sep 05, 2012 3:04 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 4:22 pm    Post subject: Reply with quote

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

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 Smile
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Gurugars
Active Member


Joined: 23 Oct 2010
Posts: 107
Location: Chennai,India.

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 4:34 pm    Post subject: Reply with quote

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:
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 Smile
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
vijay_10b
Member


Joined: 04 Sep 2012
Posts: 9

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 5:28 pm    Post subject: How to fetch and compare the system date Reply with quote

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
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 5:38 pm    Post subject: Reply with quote

Well,

Code:
//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 Smile

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

Why use a dumb jclchecker. Why not just run it?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
vijay_10b
Member


Joined: 04 Sep 2012
Posts: 9

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Wed Sep 05, 2012 5:47 pm    Post subject: How to fetch and compare the system date Reply with quote

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...............
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
dbzTHEdinosauer
Moderator


Joined: 02 Oct 2006
Posts: 981

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 6:44 pm    Post subject: Reply with quote

other than mention the original requirement was stated as:
Quote:
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:
Quote:
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.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Wed Sep 05, 2012 8:02 pm    Post subject: Reply with quote

Quote:

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.
_________________
Have a good one


Last edited by DikDude on Wed Sep 05, 2012 9:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
NicC
Active Member


Joined: 24 Jul 2011
Posts: 650
Location: Down on the pig farm

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 9:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Sep 05, 2012 9:13 pm    Post subject: Reply with quote

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

Topic moved to the sort part of the forum.

d
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1625
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Thu Sep 06, 2012 5:44 pm    Post subject: Reply with quote

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
Quote:
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
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
vijay_10b
Member


Joined: 04 Sep 2012
Posts: 9

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Sep 07, 2012 9:12 pm    Post subject: How to fetch and compare the system date in JCL Reply with quote

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,Cool
/*
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Sep 07, 2012 9:43 pm    Post subject: Reply with quote

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

However, it is extremely unprofessional to use "chat room" or "texting" speak when posting on a technical forum.
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 9:52 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-6747.html