Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare yesterday's date to the one on file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Fri Sep 22, 2017 11:35 pm    Post subject: Compare yesterday's date to the one on file
Reply with quote

Hello,

I have a date field on a file with format YYYYY/MM/DD.

I know plenty has been written in the subject, but I can't find the answer
that I need.

I am comparing using DATE1 and is not producing anything.
Same for other Date Constants.
Is there a way to create a Date Constant that I can use in the compare?
Can someone point me in the right directions using Dictionary?

Thanks
Back to top
View user's profile Send private message

migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Fri Sep 22, 2017 11:47 pm    Post subject:
Reply with quote

This is one of them
Code:

 INREC BUILD=(XNID,RNAM,RTYP,RDAT,RTIM,APID,DESC,ADAT,LPAR)                     
  INCLUDE COND=(RDAT,EQ,DATE1(-)-1)                                             
  SORT FIELDS=COPY                                                               
DATA DICTIONARY SYMBOLS SUBSTITUTED :                                           
INREC BUILD=(1,7,41,25,37,1,11,10,23,8,71,7,173,300,81,10,473,4)                 
INCLUDE COND=(11,10,CH,EQ,DATE1(-)-1)                                           
SORT FIELDS=COPY                                                                 
WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED                   
WER276B  SYSDIAG= 155214, 13111733, 13111733, 22201475                           
WER164B  10,840K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
WER164B     0 BYTES RESERVE REQUESTED, 2,408,960 BYTES USED                     
WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                                 
WER108I  SORTIN   : RECFM=FB   ; LRECL=   510; BLKSIZE= 27540                   
WER073I  SORTIN   : DSNAME=XN1U.XNESAGE.REPORT.D01                               
WER257I  INREC RECORD LENGTH =   372                                             
WER110I  SORTOUT  : RECFM=FB   ; LRECL=   372; BLKSIZE= 27900                   
WER074I  SORTOUT  : DSNAME=XN1U.XNEREPT.MQ.DAILY                                 
WER410B  9,812K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16-MEGABYTE LINE,   
WER410B     0 BYTES RESERVE REQUESTED, 2,261,504 BYTES USED                     
WER055I  INSERT          0, DELETE        535                                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                   
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                   
WER416B  SORTIN   : EXCP'S=1,UNIT=3390,DEV=28BD,CHP=(30313233343637,1),VOL=9SDMMI
WER416B  SORTOUT  : EXCP'S=0,UNIT=3390,DEV=2DB1,CHP=(30313233343637,1),VOL=9SDS@F
WER416B  TOTAL OF 1 EXCP'S ISSUED FOR COPYING                                   
WER054I  RCD IN        535, OUT          0                                       
WER169I  RELEASE 2.1 BATCH 0539 TPF LEVEL 4.1     
                               
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 189
Location: Maryland

PostPosted: Sat Sep 23, 2017 1:31 am    Post subject:
Reply with quote

The Current Date Constants (e.g. Date Functions) to be prefixed with ampersand, as per RTFM.
Quote:
INCLUDE COND=(5,8,ZD,LE,&DATE1P,AND,5,8,ZD,GT,&DATE1P-14)
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Sat Sep 23, 2017 2:25 am    Post subject:
Reply with quote

Hi Sergey,
it made no difference at all
Code:

==CHG>    INREC BUILD=(XNID,RNAM,RTYP,RDAT,RTIM,APID,DESC,ADAT,LPAR)                         
000009     INCLUDE COND=(RDAT,EQ,&DATE1(-)-2)                                                 
000010     SORT FIELDS=COPY                                                                   
000011   DATA DICTIONARY SYMBOLS SUBSTITUTED :                                               
000012   INREC BUILD=(1,7,41,25,37,1,11,10,23,8,71,7,173,300,81,10,473,4)                     
000013   INCLUDE COND=(11,10,CH,EQ,&DATE1(-)-2)                                               
000014   SORT FIELDS=COPY                                                                     
000015   WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED                       
000016   WER276B  SYSDIAG= 60039, 14404677, 14404677, 22964650                               
000017   WER164B  10,840K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,                 
000018   WER164B     0 BYTES RESERVE REQUESTED, 2,408,960 BYTES USED                         
000019   WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                                     
000020   WER108I  SORTIN   : RECFM=FB   ; LRECL=   510; BLKSIZE= 27540                       
==CHG>   WER073I  SORTIN   : DSNAME=XN1U.XNESAGE.REPORT.D01                                   
000022   WER257I  INREC RECORD LENGTH =   372                                                 
000023   WER110I  SORTOUT  : RECFM=FB   ; LRECL=   372; BLKSIZE= 27900                       
==CHG>   WER074I  SORTOUT  : DSNAME=XN1U.XNEREPT.MQ.DAILY                                     
000025   WER410B  9,812K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16-MEGABYTE LINE,       
000026   WER410B     0 BYTES RESERVE REQUESTED, 2,261,504 BYTES USED                         
000027   WER055I  INSERT          0, DELETE        535                                       
000028   WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                       
000029   WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                       
000030   WER416B  SORTIN   : EXCP'S=1,UNIT=3390,DEV=28BD,CHP=(3031323334353637,1),VOL=9SDMMI 
000031   WER416B  SORTOUT  : EXCP'S=0,UNIT=3390,DEV=11B1,CHP=(3031323334353637,1),VOL=9SDS#Q 
000032   WER416B  TOTAL OF 1 EXCP'S ISSUED FOR COPYING                                       
000033   WER054I  RCD IN        535, OUT          0                                           
000034   WER169I  RELEASE 2.1 BATCH 0539 TPF LEVEL 4.1                                       


This is the input file... I am missing something and don't know what it is


Code:
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Sat Sep 23, 2017 2:26 am    Post subject:
Reply with quote

here is the input file sample
Code:

=COLS> ----+----1----+----2----+----3
000131 UYEEJYZ   2017/09/21  02:58:07
==CHG> UYEMSJG   2017/09/21  03:10:50
==CHG> UYEZMEH   2017/09/21  00:19:48
==CHG> UYE9HEU   2017/09/21  20:46:04
==CHG> UXDC8WT   2017/09/21  04:46:35
==CHG> UXHT29O   2017/09/21  13:09:50
==CHG> UYEGWHN   2017/09/22  06:22:52
==CHG> UYENV77   2017/09/22  04:03:41
==CHG> UYEQWGV   2017/09/22  12:59:42
==CHG> UYESK5H   2017/09/22  10:48:01
==CHG> UXHT29O   2017/09/22  20:26:08
==CHG> UXJDZ1O   2017/09/22  16:43:41
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 210
Location: Chennai

PostPosted: Sat Sep 23, 2017 8:31 am    Post subject: Reply to: Compare yesterday's date to the one on file
Reply with quote

Simple, use SYMNAMES

Code:

//S1   EXEC  PGM=SORT         
//SYSOUT DD SYSOUT=*         
//SYMNAMES DD *             
HDATE,S'&LYR4/&LMON/&DAY'   
//SORTIN DD your input
//SORTOUT DD SYSOUT=*               
//SYSIN DD *                         
  OPTION COPY                       
  INCLUDE COND=(11,10,CH,EQ,HDATE)       
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Sat Sep 23, 2017 10:13 am    Post subject:
Reply with quote

Hi Magesh
this is something I tried to do for some other purposes without success...
thanks a lot..

I feel you pointed me in the right direction... but still I am not able to solve my issue.

Is it possible to assign the HDATE variable to a specific location of the input file, so I can compare it against yesterday date?
That is at the same time as reformatting the date the way you showed me I still need to point HDATE to pos 11,10 so I can compare it with yesterday date.

What I need (I believe) is something like:
INCLUDE COND=(HDATE,EQ,&DATE(-)-1)

So, is it possible to have in SYMNAMES something like
HDATE,11,10,CH,S'&LYR4/&LMON/&DAY'?
I tried with no luck...

So, how can I do it?

Thanks
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Sat Sep 23, 2017 10:15 am    Post subject:
Reply with quote

Sorry,
I mean to say...
INCLUDE COND=(HDATE,EQ,&DATE1(-)-1)
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 210
Location: Chennai

PostPosted: Sun Sep 24, 2017 4:57 am    Post subject:
Reply with quote

Use overlay to place the HDATE any where in the input

Code:

//SYMNAMES DD *                           
HDATE,S'&LYR4-&LMON-&DAY'                 
//SYSIN DD *                             
  OPTION COPY                             
  INREC OVERLAY=(31:HDATE,DATE1(-)-1)     
  OUFIL INCLUDE=(31,10,CH,EQ,41,10,CH)   


Also i have placed date1-1 in 41st position.

Now you can simply compare with 31,10,ch,eq,41,10,ch

Alternatively you can place DATE1(-)-1 in 31st position and compare with HDATE like below

Code:

//SYMNAMES DD *                         
HDATE,S'&LYR4-&LMON-&DAY'               
//SYSIN DD *                           
  OPTION COPY                           
  INREC OVERLAY=(31:DATE1(-)-1)         
  OUFIL INCLUDE=(31,10,CH,EQ,HDATE)     
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Wed Sep 27, 2017 1:41 am    Post subject: Reply to: Compare yesterday's date to the one on file
Reply with quote

My apologies to the late response, Magesh
I had trouble trying to make work using overlay. I need to read a little bit more on overlay to understand it.
So, I used Findrep and I was able to change the '/' for '-'. So now, dates looks normal...
Still not able to make the yesterday's date comparison work.
So, is there something I am missing on INCLUDE condition?
Code:

000009     INREC IFTHEN=(WHEN=(11,1,CH,EQ,C'2'),                                               
000010             FINDREP=(INOUT=(C'/',C'-'),                                                 
000011             STARTPOS=15,ENDPOS=18),HIT=NEXT),                                           
000012           IFTHEN=(WHEN=ANY,                                                             
000013             BUILD=(XNID,RNAM,RTYP,RDAT,RTIM,APID,DESC,ADAT,LPAR))                       
000018     INCLUDE COND=(RDAT,EQ,&DATE1(-)-1)                                                   
000020     SORT FIELDS=COPY                                                                     
000024   DATA DICTIONARY SYMBOLS SUBSTITUTED :                                                 
000025   INREC IFTHEN=(WHEN=(11,1,CH,EQ,C'2'),FINDREP=(INOUT=(C'/',C'-'),STARTPOS=15,ENDP       
000026   OS=18),HIT=NEXT),IFTHEN=(WHEN=ANY,BUILD=(1,7,41,25,37,1,11,10,23,8,71,7,173,300,       
000027   81,10,473,4))                                                                         
000028   INCLUDE COND=(11,10,CH,EQ,&DATE1(-)-1)                                                 
000029   SORT FIELDS=COPY                                                                       
000030   WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED                         
000031   WER276B  SYSDIAG= 79900, 9995502, 9995502, 19652725                                   
000032   WER164B  10,840K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,                   
000033   WER164B     0 BYTES RESERVE REQUESTED, 2,429,440 BYTES USED                           
000034   WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                                       
000035   WER108I  SORTIN   : RECFM=FB   ; LRECL=   510; BLKSIZE= 27540                         
000036   WER073I  SORTIN   : DSNAME=XN1U.XNESAGE.REPORT.D01                                     
000037   WER257I  INREC RECORD LENGTH =   510                                                   
000038   WER110I  SORTOUT  : RECFM=FB   ; LRECL=   510; BLKSIZE= 27540                         
000039   WER074I  SORTOUT  : DSNAME=XN1U.XNEREPT.MQ.DAILY                                       
000040   WER410B  9,812K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16-MEGABYTE LINE,         
000041   WER410B     0 BYTES RESERVE REQUESTED, 2,277,888 BYTES USED                           
000042   WER055I  INSERT          0, DELETE        535                                         
000043   WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                         
000044   WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                         
000045   WER416B  SORTIN   : EXCP'S=1,UNIT=3390,DEV=28BD,CHP=(3031323334353637,1),VOL=9SDMMI   
000046   WER416B  SORTOUT  : EXCP'S=0,UNIT=3390,DEV=16B1,CHP=(3031323334353637,1),VOL=9SDS#V   
000047   WER416B  TOTAL OF 1 EXCP'S ISSUED FOR COPYING                                         
000048   WER054I  RCD IN        535, OUT          0                                             
000049   WER169I  RELEASE 2.1 BATCH 0539 TPF LEVEL 4.1                                         

Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 210
Location: Chennai

PostPosted: Wed Sep 27, 2017 4:52 am    Post subject: Reply to: Compare yesterday's date to the one on file
Reply with quote

Try below code
Code:

INREC BUILD=(XNID,RNAM,RTYP,RDAT,RTIM,APID,DESC,ADAT,LPAR,DATE1(/)-1)
OUFIL INCLUDE=(RDAT,EQ,511,10,CH),BUILD=(1,510)
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 26
Location: USA

PostPosted: Wed Sep 27, 2017 9:43 am    Post subject:
Reply with quote

All I had to do was to follow your instructions...
I did as you suggested... added date1 at the end of the build statement.
To my surprise yesterday's date at the end of the record had the same 2017/09/25 format as the one I was initially comparing against.

So, I just had to get rid of the FINDREP I used to replace the /.
Comparing dates in the same format gave me the results I wanted!

Not sure what dates I was comparing initially.
I suspect the date was fine, but I had incorrect the start of the field.

Thank you so much, Magesh!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us