By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your response...

Discuss This Question: 21 &nbspReplies

There was an error processing your information. Please try again later.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

First, can you describe your backup procedure? In particular, is this a job that was written in house or is it the one of either the standard or BRMS backup procedures? If you can say more about it, the better an answer can be.
Next, you need to be clear in understanding job names. Anyone can run a job with any name at any time. Just because a job with a name of, say, BACKUP is running, it's not a guarantee that it is "the" BACKUP.
Tom

Thanks Tom for your answer.
The Backup Job name is DAILYBACKUP and is a control group in BRMS.It is excuted thru job scheduler.
I am looking for setting up a CL program which will run between 9:30 AM to 9:40AM and check if this backup job DAILYBACKUP is active or not.In case it is not running or in MSGW,the CL should send an alert email specifying that Backup is Inactive or in MSGW..
Please let me know if you need more information
Thanks
Hughes

Hughes:
It'd be easier if it was an in-house program that was doing the backup because you could make a trivial change to it to help identify the job. It's not really needed, but would be nice.(Does BRMS have exit points where user-written routines can be called?)
You might have no choice but to assume that any job named DAILYBACKUP will be the daily backup job that you want. It's not a serious issue, but it should be kept in mind that there is the open possibility that you will be looking at the status of the wrong job. BTW, it can't actually be named "DAILYBACKUP" since that is an 11-character name.
Do you need to run a program at a point in time between 9:30 and 9:40? Or do you need to run a program that starts at 9:30 and continues running either until 9:40 or until a job named DAILYBACKUP is found to be active? (Your program could start at 9:30 and run for a second; and DAILYBACKUP could start at 9:31.)
What if DAILYBACKUP finishes successfully at 9:29? (Changes in strategies can have major impacts on backup timings.)
What if a system problem blocks DAILYBACKUP from running? How are you expecting your program to run if IBM jobs can't run? How do you know e-mail will be working under those circumstances?
I'm not trying to be difficult. These are just things that might make a difference in the answers. The basic question you asked is fairly easy for me. It might not help you, though, if it simply doesn't work when you need it.
Assuming the job name is "DAILYBCKUP", the basic sequence would be:

If one is listed, extract the fully-qualified job name and call the Retrieve Job Status (QWCRJBST) API to see the status.

If status indicates a need, then send your alert.

None of it needs to be done in CL. It can be done in RPG, COBOL, C, probably even REXX. CL possibly makes some parts a little easier. It would mostly depend on what you're familiar with and what APIs you've called in the past. Your i5/OS version/release might make some difference.
The APIs in this task are some of the easiest ones. They're also some of the most widely used. Once a couple of them are understood, most other APIs suddenly start to make sense.
Tom

My apologies... I just realized you needed "status" like MSGW; i.e., you need 'Active Job Status'. The Retrieve Job Information (QUSRJOBI) API would be appropriate, rather than QWCRJBST.
Don't hesitate to continue the discussion, even if it's just for clarification on where stuff is documented.
Tom

Thanks Tom for your suggestion.
I am working on the solution suggested by you.
Meanwhile,I have come across a piece of code which may be simple.Can you please help me here.
The command WRKACTJOB output(*PRINT) SBS(QCTL)gives me the listing of jobs which run in subsystem QCTL along with their status.They are stored in file QPDSPAJB produced as output of above command.
The Backup job which I am targetting also runs in QCTL subsystem.The Backup Job name is DAILYBKUP and it is the only job on the system which runs with that name.It takes 4 hours to complete.At this point of time I need to check at 9:40 AM if the backup job is indeed running.
If I run the abpove WRKACTJOB command when the backup job is running and then copy the contents of the file QPDSPAJB to a database file,can I trap the STATUS field based on JOB NAME and then check it out for MSGW or ACTIVE state?
If yes,can you please let me know how I can copy the contents of QPDSPAJB properly to database file and then check out for the STATUS of the job.I am stuck up at this point as I am unable to copy the contents of QPDSPAJB properly to database file and then check the STATUS field.
Request you to please guide me thru.
Many Thanks
Hughes

You can use RUNQRY *n QTEMP/PRTWRKACT to view the resulting content in the temporary file.
You could use SBS(QINTER) as a test and use any job name in QINTER to see what that job's status is. You just read each record until one matches the job name that you're looking for. Then check the positions at the far right of that record to see if the status is whatever you're checking for.
Be aware that this method is not guaranteed to work at any time in the future. The spooled output from WRKACTJOB can (and does) change from time to time. Specify all of the parms for WRKACTJOB; don't rely on any of the defaults.
That's about the best I can offer if that's the technique you want to use.
Tom

Hi Tom,
Thank you for your inputs.I am working on Report Parsing method currently.The backup job name ,the sbs in which it runs and the profile thru which it runs is already known.
I am not very good in programming (and using API)and hence I chose this method which I found easy to understand and code.
I actually just need to know if the job is ACTIVE or in MSGW or not running.
I run the following command and produce the oiutfile:
WRKSBSJOB SBS(QCTL) USER(LIVEPROD) OUTPUT(*PRINT)
Then I copy the spool file QPDSPSBJ thru CPYSPLF to a file named message20 of standard length 132 as suggested by you:
CPYSPLF FILE(QPDSPSBJ) TOFILE(TEST/MESSAGE20) SPLNBR(*LAST)
On viewing the file message20,the report is as shown:
Line ....+....1....+....2....+....3....+....4....+....5 ..
MESSAGE20
000001 5722SS1 V5R4M0 060210 Work with
000002
000003 Subsystem . . . . . . . . . : QCTL
000004
000005 Job Name User Number Type ----Status
000006 MOVMEDBRM LIVEPROD 374971 BATCH MSGW
As you can see,the JOBNAME/USERPROFILE/STATUS field can be seen in file Mesage20.
The job name starts at position 4 in the Message20 file and is 9 Charachetr long.The User starts at position 17 and is 8 charachetr long.The Status starts at position 49 and is 4 charachter long.
I am stuck up at CL program and my doubt is that I am not parsing the Job Name /User and Status field correctly or not reading the file correctly. .
My CL is as follows:
PGM
DCLF FILE(TEST/MESSAGE20)
DCL VAR(&MESSAGE20) TYPE(*CHAR) LEN(132)
DCL VAR(&JOB) TYPE(*CHAR) LEN(9)
DCL VAR(&STATUS) TYPE(*CHAR) LEN(4)
DCL VAR(&USER) TYPE(*CHAR) LEN(8)
WRKSBSJOB SBS(QCTL) USER(LIVEPROD) OUTPUT(*PRINT)
*
/*Copy output of QPDSPSBJ to Message20 file*/
*
CPYSPLF FILE(QPDSPSBJ) TOFILE(TEST/MESSAGE20) SPLNBR(*LAST)
*
/*Retreive STATUS/USER PROFILE/JOB NAME from Message20 file*/
CHGVAR VAR(&STATUS) VALUE(%SST(&MESSAGE20 49 4))
CHGVAR VAR(&USER) VALUE(%SST(&MESSAGE20 17 8))
CHGVAR VAR(&JOB) VALUE(%SST(&MESSAGE20 4 9))
/*Pls advice if the above parsing is correct*/
*
/*Send the message based on Job Name and Status*/
*
IF COND(&JOB *EQ 'MOVMEDBRM') THEN(DO)
IF COND(&STATUS *EQ 'MSGW') THEN(DO)
SNDDST TYPE(*LMSG) TOUSRID((HUGHES SYS01)) +
TOINTNET((hughes10in@gmail.com)) DSTD('MOVMEDBRM is in MSGW')
MONMSG MSGID(CPF0000)
ENDDO
ENDDO
DLTSPLF(QPDSPSBJ)
CLRPFM(test/message20)
ENDPGM
I checked the subsystem and the job MOVMEDBRM is stikll in message wait but I did not receive the message for MSGW.
Where am I making the mistake?Do I need to put some extra code for reading the file or paring the report
Kindly advice where I am wrong.
Hughes

Where am I making the mistake?
You're not reading any of the records from the file. You need to issue a RCVF command to receive a record from the file before you can test any values in the record. After your IF tests, if you don't find the job name that you want, you have to loop back to receive the next record.
Eventually, you will either find a record for your target job or you will reach end-of-file (EOF).
EOF will be signalled by message CPF0864 from RCVF.
Tom

...unfortunatlely this is not working.
Why not? What happens? If you get errors, what are they? Where and when do you see them? Do you see errors when you enter source, when you compile or when you run? (Be sure to include any message identifiers if you report any messages.)
I can't run the program successfully because it uses values that only exist on your system, so I can't be certain what would happen. You have to tell me.
I can tell from looking that the program shouldn't compile. It shouldn't even get past a source editor.
This piece, for example:

You have a continuation character in front of the MONMSG command. A source editor should flag that as an error when you try to enter that as a source statement.
Also, you specified TYPE(*LMSG) but you didn't supply any LONGMSG() text. You supplied a MSG() parameter instead.
Of course, if you want to send to an internet e-mail address, you shouldn't be using SNDDST. But it will work in most circumstances. The most likely times for it not to work are when the system is having problems
Other than those, it looks okay.
Tom

Use SNDPGMMSG to put something into the joblog to see what is being processed. Verify whether or not the angle-brackets are concatenated directly with the values to ensure that you're not off by one or more bytes to the right or left when you substring. Verify that you're actually reading the records that you think you're reading.
As stated at the beginning, I wouldn't process the spooled file in the first place. It's not exactly a big degree of difficulty better than using the APIs. There are actually more areas to understand -- temporary files, file I/O, overrides, and more.
Tom

Here is the content of message20 file:
Unfortunately, you didn't paste it in a way that preserved the formatting. I can't tell what position anything is in. Different systems might have slightly different formatting due to system CCSID differences or possibly other elements. I can't tell if your %SST() functions are getting the right values.
The best way to preserve formatting with this editor seems to be with a "code" block. After you paste something in, select the text and click the "code" button. That should keep spacing the same as the original.
On running the below program...
As near as I can tell, the source that you pasted won't compile. So that couldn't be the program that you were running.
Also, how have you determined that the program is reading the file that you put the records into? Have you used STRDBG to verify that the records are what you expect? Or did you insert any code to display the values in your variables to let you know that your program is seeing what you think it's seeing? Far too often we don't check what is going on inside of a program because we're certain we already know what's going on.
Tom

Hi Tom,
I have sent the contents of message20(as a screenshot) file to your email id :tom.liotta@gmail.com.I was unable to paste it in correct format even after pressing the code button.Si send this as an attachment to your email with Subject as Report
I got this id from your website http://zap.to/tl400
Kindly let me know if my program is reading the file correctly or my looping is correct?
Thanks again for your help

Is the variable name &MESSAGE20 the field name...
Most likely, it is the field name. When you run CRTPF xxx RCDLEN(nnn), the file is created with a single-field record format and the single-field is named the same as the file.
Tom

I was unable to paste it in correct format even after pressing the code button.
How could you tell? The formatting doesn't take effect until you actually post the message.
There is some importance to having it here. There will be others who might read this thread. They will want to see what is being talked about.
I wrote this just as a consideration for those who will come later.
Tom

Do let me know if you need any more information from me.
The most important thing to know is if your program is reading the file records that you think it's reading.
The program structure looks good enough. And the substringing looks appropriate.
Now, is the override appropriate? I can't tell. I'd need some debugging info to know for sure. Logging the variable values in the joblog is one easy way to do that.
According to your joblog, the SNDDST is never reached. If the substrings are correct, then the data in the records isn't what you think it is. You have to see what the program sees; not what you expect it to see. Have the program show you what it sees.
Tom

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your reply...

Ask a Question

Free Guide: Managing storage for virtual environments

Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!

To follow this tag...

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy