|
View previous topic :: View next topic
|
| Author |
Message |
arunsoods
New User

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
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 |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1217 Location: Dublin, Ireland
|
|
|
|
Throwing? on z/OS?
What output do you get - any error messages? do you see the SYMNAMES resolved?
Garry. |
|
| Back to top |
|
 |
arunsoods
New User

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
I checked that in CDATE field &DATE2 is populated.
Its should pick current time. |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Nothing is "thrown" on z/OS - ever.
What output did you get? What was your input? |
|
| Back to top |
|
 |
Smita.t2
New User

Joined: 17 Apr 2012 Posts: 31 Location: Bangalore
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2286 Location: USA
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|