IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Comparision with current time


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Thu Nov 09, 2017 10:37 am
Reply with quote

Hi All,

I have written below code to compare a field of my dataset with current time and if it is less than current time we have to OMIT it. Below code is not throwing any error but not throwing correct output as well. Can someone please look into this:-

Code:

//STEP01   EXEC PGM=SORT                     
//SYMNAMES DD *                             
    CTIME,S'&TIME2'                         
//SORTJNF1 DD DSN=GMMM.JOB.DET.FMT,         
//            DISP=SHR                       
//SORTJNF2 DD DSN=GMMM.JOB.SLA.FMT,         
//            DISP=SHR                       
//SORTOUT  DD DSN=GMMM.BATCH.JOB.OUT,       
//            DISP=(NEW,CATLG,DELETE),       
//            DATACLAS=STANDARD,             
//            DCB=(DSORG=PS,RECFM=FB)       
//SYSOUT   DD SYSOUT=*                       
//SYSIN    DD *                             
  JOINKEYS FILE=F1,FIELDS=(1,08,A)           
  JOINKEYS FILE=F2,FIELDS=(1,08,A)           
  REFORMAT FIELDS=(F1:1,08,F2:10,4,F1:10,20)
  JOIN UNPAIRED,F2                           
  SORT FIELDS=COPY                           
  OMIT COND=(9,4,CH,LT,CTIME)               
/*                   
[/code]
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1097
Location: Dublin, Ireland

PostPosted: Thu Nov 09, 2017 2:26 pm
Reply with quote

Throwing? on z/OS?

What output do you get - any error messages? do you see the SYMNAMES resolved?

Garry.
Back to top
View user's profile Send private message
arunsoods

New User


Joined: 13 Jul 2016
Posts: 35
Location: India

PostPosted: Thu Nov 09, 2017 4:57 pm
Reply with quote

I checked that in CDATE field &DATE2 is populated.

Its should pick current time.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2432
Location: Hampshire, UK

PostPosted: Thu Nov 09, 2017 5:04 pm
Reply with quote

Nothing is "thrown" on z/OS - ever.
What output did you get? What was your input?
Back to top
View user's profile Send private message
Smita.t2

New User


Joined: 17 Apr 2012
Posts: 28
Location: Bangalore

PostPosted: Tue Nov 14, 2017 4:18 pm
Reply with quote

Please try.

Code:

//STEP01   EXEC PGM=SORT                     
//SYMNAMES DD *                             
     CTIME,S'&TIME2'                         
//SORTJNF1 DD DSN=GMMM.JOB.DET.FMT,         
//            DISP=SHR                       
//SORTJNF2 DD DSN=GMMM.JOB.SLA.FMT,         
//            DISP=SHR                       
//SORTOUT  DD DSN=GMMM.BATCH.JOB.OUT,       
//            DISP=(NEW,CATLG,DELETE),       
//            DATACLAS=STANDARD,             
//            DCB=(DSORG=PS,RECFM=FB)       
//SYSOUT   DD SYSOUT=*
//JNF2CNTL DD *
  OPTION COPY
  OMIT COND=(10,4,CH,LT,CTIME) 
/*                       
//SYSIN    DD *                             
  JOINKEYS FILE=F1,FIELDS=(1,08,A)           
   JOINKEYS FILE=F2,FIELDS=(1,08,A)           
   REFORMAT FIELDS=(F1:1,08,F2:10,4,F1:10,20)
   JOIN UNPAIRED,F2                           
   SORT FIELDS=COPY                           
             
/*

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

Active Member


Joined: 29 Apr 2008
Posts: 879
Location: Maryland

PostPosted: Tue Nov 14, 2017 8:56 pm
Reply with quote

arunsoods wrote:
I have written below code to compare a field of my dataset with current time and if it is less than current time we have to OMIT it. Below code is not throwing any error but not throwing correct output as well.

Besides of all, the explanation of your task doesn't match in any way the example of your code.

Nevertheless, whenever results are not clear, try to investigate the code step by step, starting from the most primitive version of it.
Code:
//CTIME2   EXEC PGM=SORT                                             
//*                                                                   
//SYMNAMES DD *                                                       
CTIME,S'&TIME2'                                                       
//*                                                                   
//SORTIN   DD *                                                       
00000000  1010BBBBBBCCCCCCCCCC
11111111  1011BBBBBBCCCCCCCCCC
22222222  1012BBBBBBCCCCCCCCCC
33333333  1013BBBBBBCCCCCCCCCC
44444444  1014BBBBBBCCCCCCCCCC
55555555  1015BBBBBBCCCCCCCCCC
66666666  1016BBBBBBCCCCCCCCCC
77777777  1017BBBBBBCCCCCCCCCC
88888888  1018BBBBBBCCCCCCCCCC
//*                                                                   
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  OMIT COND=(10,4,CH,GT,CTIME)                                       
  SORT FIELDS=COPY                       
  OUTREC FIELDS=(1,30,X,&TIME2,X,CTIME)   
  END                                     
//*                                       


As we can find, the SORT statements do work absolutely not in that way you assumed:
Code:
SYSIN :                                       
  OMIT COND=(10,4,CH,GT,CTIME)               
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1,30,X,&TIME2,X,CTIME)       
 END                                         
DATA DICTIONARY SYMBOLS SUBSTITUTED :         
OMIT COND=(10,4,CH,GT,C'&TIME2')             
SORT FIELDS=COPY                             
OUTREC FIELDS=(1,30,X,&TIME2,X,C'&TIME2')     

And the output is not what is expected
Code:
----+----1----+----2----+----3----+----4--
00000000  1010BBBBBBCCCCCCCCCC 1016 &TIME2
11111111  1011BBBBBBCCCCCCCCCC 1016 &TIME2
22222222  1012BBBBBBCCCCCCCCCC 1016 &TIME2
33333333  1013BBBBBBCCCCCCCCCC 1016 &TIME2
44444444  1014BBBBBBCCCCCCCCCC 1016 &TIME2
55555555  1015BBBBBBCCCCCCCCCC 1016 &TIME2
66666666  1016BBBBBBCCCCCCCCCC 1016 &TIME2
77777777  1017BBBBBBCCCCCCCCCC 1016 &TIME2
88888888  1018BBBBBBCCCCCCCCCC 1016 &TIME2

I hope, this initial explanation might be enough for you to continue YOUR OWN WORK by yourself, not asking for the final ready-to-use solution?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
No new posts current batch plan DB2 3
No new posts How to process dependent file based o... JCL & VSAM 8
No new posts Trying to add current date in place o... DFSORT/ICETOOL 8
No new posts How to filter out certain records bas... JCL & VSAM 5

Back to Top