I am calling this API that is an RPG program. When I run the program in debug mode it runs fine and displays all my jobques on the screen. When I enddbg, the program only goes through the code 1 time. Would anyone know why this is happening?
Software/Hardware used:
ASKED:
July 30, 2008 5:30 PM
UPDATED:
May 12, 2010 2:13 PM
Hi,
Is the one OUTQ that it shows the last one from your list by any chance?
Regards,
Martin.
I suspect that your code is looping through the job queue names just fine, whether through debug or not. The DSPLY operation is intended to be just a quick and easy way for a program to communicate to the requestor via a message, generally for a temporary solution such as validating output during testing.
I have found that its behavior can be influenced by settings external to the program. Check the message logging options for your interactive job (via the DSPJOB command). Ensure that they’re not set for *NOLIST or level 0, for example. I have noticed different behavior depending on which invocation level an interactive job is currently in (such as when you press F10 from PDM, or call the QCMD program to get a new command line).
If you created a subfile so that your program could load all the JobQ names and then display that subfile on the screen, you could then verify the behavior, as well as not requiring the user to have to press Enter each time to see the next JobQ. Or if you just look through your job log, you’ll probably see that all the names do get displayed, but the screen isn’t pausing due to the factors above.
AActually I do have my job logging set up correctly. I have this line of code in my CL. (CHGJOB LOG(4 00 *SECLVL) LOGCLPGM(*YES)) rite before I call my RPGLE program.. When I look through my job log, I only see the first outque displayed when running not in debug mode. Please see below. When I run it in debug mode I get 37 different jobqueues listed in the job log, so I know it works running in debug.
6 > call XSPOLJBQPG
DSPLY BUSINT
DSPLY QGPL
DSPLY *Finished*
I am actually writing the job queue names to a work file that I created and I have the DSPLY command commented out so it is working somewhat like a subfile. I just wanted to get this version of the program working with the DSPLY command without having to run it in debug mode. What I was trying to accomplish was to write out all the names of my outqueues and libraries to a PF and then call another program to do analysts type stuff.
Okay, to narrow it down, what about this?
In the For loop, you could add a DSPLY statement for displaying the value of the TotalRecs variable for each iteration, to verify that it is finding all the JobQs from the API call?
I finally got it to work another way. I replaced my FOR statment with a Do somany times and it seems to work ok.. Thank you both for all of your suggestionswith this matter. This is a great website to ask questions and I look foward to using it again in the future.
Thanks Again Guyes!!!!!
I see that a work around was found, but was curious as to where TotalRecs gets loaded with a value other than 0??
See it now – in the ListInfo data structure being loaded by the API. Thought that might have been why the program wasn’t looping thru all the items. Guess not.