View previous topic :: View next topic
|
Author |
Message |
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Hello, how are you?
I checked the IF section in the manual reference of jcl but there's nos the answer nor examples
My need is check if the actual time is 10pm.
I can save that value in a control-m variable, but how can I create a step that says:
Code: |
IF %%HH GT 22
//* (DO CERTAIN THING)
|
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Basically the JCL syntax here is wrong, then please read description of IF. And yes, it is (with limitations) possible with JCL means. |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Joerg.Findeisen wrote: |
Basically the JCL syntax here is wrong, then please read description of IF. And yes, it is (with limitations) possible with JCL means. |
I read the IF section in the reference manual, but only found examples with RC, or ABEND. I cant find an example using IF %%time GE 120000 can you give me some example? or we can only use IF with RC, ABEND, and keywords like that? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
|
|
One way is to use DFSORT to get current timestamp and find HH:MM from it and compare with 10 PM to set RC 4 or 0 accordingly. and then in the next step use IF RC from DFSORT step to do "Certain things".
But wait, why do all this, using Job scheduler , schedule a job to run at 10 PM , what is stopping that? |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Rohit Umarjikar wrote: |
One way is to use DFSORT to get current timestamp and find HH:MM from it and compare with 10 PM to set RC 4 or 0 accordingly. and then in the next step use IF RC from DFSORT step to do "Certain things".
But wait, why do all this, using Job scheduler , schedule a job to run at 10 PM , what is stopping that? |
Hello Friend, I need to do this because we are having some problem with some file that sometimes another company is sending in the wrong times, so, I have to check if the job is executing after 10pm, if this is the case I have to put that file information in another file in order to procces automatically that missing or delayed file.
Thanks to both of you !! I will check this solution, but it seems great. |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Rohit Umarjikar wrote: |
One way is to use DFSORT to get current timestamp and find HH:MM from it and compare with 10 PM to set RC 4 or 0 accordingly. and then in the next step use IF RC from DFSORT step to do "Certain things".
But wait, why do all this, using Job scheduler , schedule a job to run at 10 PM , what is stopping that? |
Hello, can I ask you some example to compare in the sort utility? my company does not have any example about it. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Make use of system symbols and remember that you might need a dummy step before the first IF. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Sample:
Code: |
//* - An IF statement specified before the first EXEC statement
//* in a job is not evaluated before the first step executes.
//*
//INIT EXEC PGM=IEFBR14 * INITIALIZE JOB/STEP TABLE
// IF (&LDAY. LT 2) THEN * READ LAST DAY OF PREV MONTH AND ALL NEW
//DAY1 EXEC PGM=IEFBR14
// ENDIF |
Jobclass MUST have SYSSYM allowed! |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Joerg.Findeisen wrote: |
Sample:
Code: |
//* - An IF statement specified before the first EXEC statement
//* in a job is not evaluated before the first step executes.
//*
//INIT EXEC PGM=IEFBR14 * INITIALIZE JOB/STEP TABLE
// IF (&LDAY. LT 2) THEN * READ LAST DAY OF PREV MONTH AND ALL NEW
//DAY1 EXEC PGM=IEFBR14
// ENDIF |
Jobclass MUST have SYSSYM allowed! |
Thanks.
Is there a system symbol of the hour? In my companty there are examples about &LMON.-&LDAY. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Use SDSF -> SYM to find a matching one. |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Joerg.Findeisen wrote: |
Use SDSF -> SYM to find a matching one. |
Hello, im having a problem, with the next error:
8 IEFC016I ERROR IN IF STATEMENT
I cant see what can it be.
Code: |
//FREE67 EXEC PGM=IEBGENER
//SYSUT1 DD DSN=DM.BO.PAGTOTAL.DOLP44,
// DISP=SHR,FREE=CLOSE
//SYSUT2 DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//*
//INIT EXEC PGM=IEFBR14
// IF (&LHR. LT 2) THEN
//SORT0002 EXEC SORT
//SORTIN DD DSN=DM.BO.PAGTOTAL.DOLP44,
// DISP=SHR
//SORTOUT DD DSN=DM.BO.REVER.DSQQID5,
//* DCB=(LRECL=190),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(1000,500),RLSE),VOL=(,,,6)
INCLUDE COND=(8,3,CH,EQ,C'XXX')
SORT FIELDS=(1,7,CH,A,11,19,CH,A)
OUTFIL FNAMES=SORTOUT,REMOVECC,LINES=56,
HEADER2=(2:DATE)
// ENDIF |
[/code] |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Show JESJCL of your Job. I assume the symbols are not resolved, but I have written that you should check that! It should come up like this:
Code: |
3 //INIT EXEC PGM=IEFBR14 * INITIALIZE JOB/STEP TABLE
4 // IF (&LDAY. LT 2) THEN * READ LAST DAY OF PREV MONTH AND ALL NEW
IEFC653I SUBSTITUTION JCL - (02 LT 2)
5 //DAY1 EXEC PGM=IEFBR14
6 // ENDIF |
|
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Joerg.Findeisen wrote: |
Show JESJCL of your Job. I assume the symbols are not resolved, but I have written that you should check that! It should come up like this:
Code: |
3 //INIT EXEC PGM=IEFBR14 * INITIALIZE JOB/STEP TABLE
4 // IF (&LDAY. LT 2) THEN * READ LAST DAY OF PREV MONTH AND ALL NEW
IEFC653I SUBSTITUTION JCL - (02 LT 2)
5 //DAY1 EXEC PGM=IEFBR14
6 // ENDIF |
|
hello joerg, im reading about jesjcl because really I never worked or touched that concept. Maybe later I can ask you again, because right know Iam abusing your good willing.
Im a java programmer and little by little learning things of mainframe environment, and JESJCL is a concept that I know nothing and I have to study, so as I said later perhaps I will ask again.
Thanks. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
In SDSF ST Menu, in front of the Job, type '?'. You will then see what I mean. Not so tricky. |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Joerg.Findeisen wrote: |
In SDSF ST Menu, in front of the Job, type '?'. You will then see what I mean. Not so tricky. |
Thanks yes, I use the sdsf to see the output of jobs, etc.
I convey you my code, I see that the sentence you mentioned is not appearing. How can I solve this?
Code: |
1 //EVX48888 JOB (01,BE,&SYSUID,0000000,PPPPPPPP),
//* USER=EW19,PASSWORD=XXXXXXXX,
// CLASS=A,MSGCLASS=X,COND=(4,LT),
// NOTIFY=&SYSUID
//* RESTART=DELE0380
//*
//********************************************************************
//*
//* ===> VARIABLE TIEMPO DE PROCESO (FORMATO HHMMSS)
//* %%SET %%HHMMSS = %%TIME
//************************************************************
IEFC653I SUBSTITUTION JCL - (01,BE,EVX4,0000000,PPPPPPPP),CLASS=A,MSGC
2 //FREE67 EXEC PGM=IEBGENER
3 //SYSUT1 DD DSN=DM.BO.PAGTOTAL.DOLP44,
// DISP=SHR,FREE=CLOSE
4 //SYSUT2 DD DUMMY
5 //SYSPRINT DD SYSOUT=*
6 //SYSIN DD DUMMY
//*
7 //INIT EXEC PGM=IEFBR14
8 // IF (LHR.LT22) THEN
9 //SORT0002 EXEC SORT
10 XXSORT EXEC PGM=ICEMAN
11 XXSYSOUT DD SYSOUT=*
12 XXSYSPRINT DD DUMMY
13 XXSYSLMOD DD DSNAME=&&GOSET,
XX UNIT=SYSDA,
XX SPACE=(3600,(20,20,1))
14 XXSYSLIN DD DSNAME=&&LOADSET,
XX UNIT=3390,SPACE=(80,(10,10))
15 XXSYSUT1 DD DSNAME=&&SYSUT1,
XX SPACE=(1024,(60,20)),
XX UNIT=SYSDA
16 //SORTIN DD DSN=DM.BO.PAGTOTAL.DOLP44,
// DISP=SHR
// DISP=SHR
17 //SORTOUT DD DSN=DM.BO.REVER.DSQQID5,
//* DCB=(LRECL=190),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(1000,500),RLSE),VOL=(,,,6)
18 //SYSIN DD * GENERATED STATEMENT
19 // ENDIF |
|
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
This is what I found
SysSym
A NO MAXRC YES DISALLOW
B NO MAXRC YES DISALLOW
C NO MAXRC YES DISALLOW
D NO MAXRC YES DISALLOW
E NO MAXRC YES DISALLOW
F NO MAXRC YES DISALLOW
G NO MAXRC YES DISALLOW
H NO MAXRC YES DISALLOW
I NO MAXRC YES DISALLOW
J NO MAXRC YES DISALLOW
The only way to activate this is talking with some person of my company? |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Rohit Umarjikar wrote: |
One way is to use DFSORT to get current timestamp and find HH:MM from it and compare with 10 PM to set RC 4 or 0 accordingly. and then in the next step use IF RC from DFSORT step to do "Certain things".
But wait, why do all this, using Job scheduler , schedule a job to run at 10 PM , what is stopping that? |
Can I ask some code of your own to see this working?
My company really even when I searched long I cant found any example. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1348 Location: Bamberg, Germany
|
|
|
|
Ali_gezer wrote: |
I convey you my code, I see that the sentence you mentioned is not appearing. How can I solve this? |
Code: |
8 // IF (&LHR. LT 22) THEN
|
Notice the difference to what you have coded. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2154 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
Ali_gezer wrote: |
I convey you my code, I see that the sentence you mentioned is not appearing. How can I solve this? |
Code: |
8 // IF (&LHR. LT 22) THEN
|
Notice the difference to what you have coded. |
Quote: |
The difference is only in two slashes, and two spaces, - who cares of them?! |
|
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Joerg.Findeisen wrote: |
Ali_gezer wrote: |
I convey you my code, I see that the sentence you mentioned is not appearing. How can I solve this? |
Code: |
8 // IF (&LHR. LT 22) THEN
|
Notice the difference to what you have coded. |
That code that you see at last was one of my several tries. I proved with the code you put before and after your last message and did not work neither.
I see in sdsf that syssym are disallowed for all the classes
This is what I found
SysSym
A NO MAXRC YES DISALLOW
B NO MAXRC YES DISALLOW
C NO MAXRC YES DISALLOW
D NO MAXRC YES DISALLOW
E NO MAXRC YES DISALLOW
F NO MAXRC YES DISALLOW
G NO MAXRC YES DISALLOW
H NO MAXRC YES DISALLOW
I NO MAXRC YES DISALLOW
J NO MAXRC YES DISALLOW
and I read some post in the forum that I have to speak with the system manager of my company but I dont think that they are going to modify anything.
That's why I asked to the other person if he could bring me some code using the sort utility to make this comparision. Can you give me some example or clue if you have one?
thanks again. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10891 Location: italy
|
|
|
|
time to lock the topic, it is getting nowhere! |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
enrico-sorichetti wrote: |
time to lock the topic, it is getting nowhere! |
But Joer brought me some solution but I can not use it because system symbols are blocked in my company, so I asked if someone can give me one example using sort. Rohit told me that I can use sort utility to achieve this solution but I cant find some example in my company nor the forum. Perhaps with some example (in the if section of the jcl reference there is only examples with keywords) I can solve this. |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
I made a solution for this.
first I get the time by a sort
second I made other step using an INCLUDE sentence to find if the earlier file has the time I need. If found, made a only record.
Then I made other step that checks if the file has anything, if has anything it would be a correct rc, and then proceed.
Thanks, you can close de topic. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3077 Location: NYC,USA
|
|
|
|
Based on what you said above you have Couple of options
1. Talk to job scheduling team at your organization and set up a watcher job ( which will see if 10 PM job is completed or not ) which can be used for taking action as needed.
2. Write a new job which will run anytime after 10PM
A. Get the creation date of the dataset ( of the 10 PM job) -
Use LISTCAT , IDCAMS facility.
B. Compare the creation date from step step A to current date
using DFSORT and set RC
C. Based on RC from step B , decide to copy else no copy.
Please search this forum for A and B, this is discussed so many times. I shall try tomorrow but meanwhile please do research and try by yourself.
3. Try dfsort as suggested. e.g
ibmmainframes.com/about65572.html
ibmmainframes.com/about40597.html
ibmmainframes.com/viewtopic.php?t=42664&postdays=0&postorder=asc&start=0 |
|
Back to top |
|
|
Ali_gezer
Active User
Joined: 06 Apr 2021 Posts: 123 Location: argentina
|
|
|
|
Rohit Umarjikar wrote: |
Based on what you said above you have Couple of options
1. Talk to job scheduling team at your organization and set up a watcher job ( which will see if 10 PM job is completed or not ) which can be used for taking action as needed.
2. Write a new job which will run anytime after 10PM
A. Get the creation date of the dataset ( of the 10 PM job) -
Use LISTCAT , IDCAMS facility.
B. Compare the creation date from step step A to current date
using DFSORT and set RC
C. Based on RC from step B , decide to copy else no copy.
Please search this forum for A and B, this is discussed so many times. I shall try tomorrow but meanwhile please do research and try by yourself.
3. Try dfsort as suggested. e.g
ibmmainframes.com/about65572.html
ibmmainframes.com/about40597.html |
Thank you so much for you explanation, it is a gold for me, I already implemented a solution that a jus put ealier before this comment of yours. But anyways is a very great explanation that would serve me in the future and to other people here in this forum |
|
Back to top |
|
|
|