We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

How can I determine if a Job is not active from withing an ILE-RPG program?

Phillip Knox
Phillip Knox asked
on
Medium Priority
1,483 Views
Last Modified: 2012-05-06
I have stored the (job number, name, and user) of particular jobs in a PF. I need to be able to know if one of the (job number,name,user) entries stored in the physical file are not active when the record is read. I need this answer really fast please. Phil
Comment
Watch Question

Hi use the folloing API
here is an example
The status is in field status in the Jobi0100  data structure


D Job             s             10    
D User            s             10    
D Jobnbr          s              6    
D Qusrjobi        Pr                  ExtPgm('QUSRJOBI')              
D  P_Receiver                         Like(Jobi0100)                  
D  P_Reclen                           Like(Reclen)    Const           
D  P_Format                           Like(Format)    Const           
D  P_Job                              Like(Fulljob)   Const           
D  P_Ijob                             Like(Ijob)      Const           
D  P_Error                            Like(Errords)   Const           
D Jobi0100        Ds                                                                  
D  Intjobid                     16    Overlay(Jobi0100:35)                            
D  Status                       10    Overlay(Jobi0100:51)                            
D                                                                                     
D Reclen          S             10I 0 Inz(%Size(Jobi0100))                            
D Format          S              8    Inz('JOBI0100')                                 
D Fulljob         S             26                                                    
D Ijob            S             16                                                    
                                                                                      
C                   Reset                   Jobi0100                                  
C                   Reset                   Errords                                   
                                                                                      
C                   Eval      Fulljob = Job + User + Jobnbr                           
C                   Callp     Qusrjobi(Jobi0100                                       
C                                      : Reclen                                       
C                                      : Format                                       
C                                      : Fulljob                                      
C                                      : Ijob                                         
C                                      : Errords)       

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Hi Phil,

If you already have all the information (job number, name, and user), you can just do a DSPJOB  with JOB parameter filled and enter *STSA in option parameter. First line on the screen is the job status...

Is that what you're looking for ?

Lewis
my error ds is
 D ErrorDS         ds                  Qualified Inz                    
 D   BytesProv                   10i 0 inz(%size(ErrorDS))              
 D   BytesAvail                  10i 0                                  
 D   MsgId                        7                                    
 D   Spare                        1                                    
 D   text                        52                                    
Phillip KnoxSenior Systems Analyst

Author

Commented:
Dave,
What am I looking for in errorDS?
here is what the output looks like

EVAL Jobi0100                          
INTJOBID OF JOBI0100 = ' Ï   °ï´o;´
STATUS OF JOBI0100 = '*ACTIVE   '      

EVAL Errords                          
ERRORDS.BYTESPROV = 68                
ERRORDS.BYTESAVAIL = 0                
ERRORDS.MSGID = '       '              
ERRORDS.SPARE = ' '                    
ERRORDS.TEXT = '                      


Ps I have just updated the Program to change the job etc from a parm to a variable

Dave
error ds is needed for the api

here is a full working priogram  - the job INZ for the job is my job number

H                                                                                  
D ErrorDS         ds                  Qualified Inz                                
D   BytesProv                   10i 0 inz(%size(ErrorDS))                          
D   BytesAvail                  10i 0                                              
D   MsgId                        7                                                 
D   Spare                        1                                                 
D   text                        52                                                 
D                                                                                  
D Job             s             10     Inz('SDSA1')                                
D xUser           s             10     Inz('DAVIDS')                               
D Jobnbr          s              6     Inz('192282')                               
D Qusrjobi        Pr                  ExtPgm('QUSRJOBI')                           
D  P_Receiver                         Like(Jobi0100)                               
D  P_Reclen                           Like(Reclen)    Const                        
D  P_Format                           Like(Format)    Const                        
D  P_Job                              Like(Fulljob)   Const                        
D  P_Ijob                             Like(Ijob)      Const                        
D  P_Error                            Like(Errords)   Const                        
D Jobi0100        Ds                                                               
D  Intjobid                     16    Overlay(Jobi0100:35)                      
D  Status                       10    Overlay(Jobi0100:51)                      
                                                                                
D                                                                               
D Reclen          S             10I 0 Inz(%Size(Jobi0100))                      
D Format          S              8    Inz('JOBI0100')                           
D Fulljob         S             26                                              
D Ijob            S             16                                              
                                                                                
C                   Reset                   Jobi0100                            
C                   Reset                   Errords                             
 
 ** use your datbase fields here to make 
                                                                                
C                   Eval      Fulljob = Job + xUser + Jobnbr                    
C                   Callp     Qusrjobi(Jobi0100                                 
C                                      : Reclen                                 
C                                      : Format                                 
C                                      : Fulljob                                
C                                      : Ijob                                   
C                                      : Errords)                               
c                   Eval      *inlr = *on                     
C                   return                                    

Open in new window

Phillip KnoxSenior Systems Analyst

Author

Commented:
It looks like I just need to see if 'STATUS OF JOBI0100' is = to *ACTIVE, right?

Yep, but if the job is inactive you need to check the errords
Message ID       Error Message Text
CPF24B4 E       Severe error while addressing parameter list.
CPF3CF1 E       Error code parameter not valid.
CPF3CF2 E       Error(s) occurred during running of &1 API.
CPF3C19 E       Error occurred with receiver variable specified.
CPF3C20 E       Error found by program &1.
CPF3C21 E       Format name &1 is not valid.
CPF3C24 E       Length of the receiver variable is not valid.
CPF3C36 E       Number of parameters, &1, entered for this API was not valid.
CPF3C51 E       Internal job identifier not valid.
CPF3C52 E       Internal job identifier no longer valid.
CPF3C53 E       Job &3/&2/&1 not found.
CPF3C54 E       Job &3/&2/&1 currently not available.
CPF3C55 E       Job &3/&2/&1 does not exist.
CPF3C57 E       Not authorized to retrieve job information.
CPF3C58 E       Job name specified is not valid.
CPF3C59 E       Internal identifier is not blanks and job name is not *INT.
CPF3C90 E       Literal value cannot be changed.
CPF9820 E       Not authorized to use library &1.
CPF9872 E       Program or service program &1 in library &2 ended. Reason code &3.

Dave
Phillip KnoxSenior Systems Analyst

Author

Commented:
Excellent. Thanks, Dave
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.