Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

typical API's you use

Status
Not open for further replies.

PeteAmsterdam

Programmer
Jun 3, 2005
76
US
Looking for any experience w/ API's. How and which ones do you typically use.
THanks,
Pete
 
QMHSNDPM is likely the API I use the most in my ILE RPG programs to send escape or info messages.

F.E.

Code:
D SndPgmMsg       PR                  ExtPgm('QMHSNDPM')     
D  MsgId                         7    Const                  
D  QualMsfF                     20    Const                  
D  MsgData                    9999    Const Options(*varsize)
D  MsgDataLen                   10i 0 Const                  
D  MsgType                      10    Const                  
D  ToCSE                        10    Const Options(*VarSize)
D  ToCSECtr                     10i 0 Const                  
D  MsgKey                        4                           
D  ErrCode                        *   Const                      
...
 /free
   ...
      Msg = This is a test to cancel the program';
      MsgKey = ' ';
      sndpgmmsg( 'CPF9898' : 'QCPFMSG   QSYS'
                           : Msg       : %Len(Msg)       
                           : '*ESCAPE' : '*'             
                           : 0         : MsgKey          
                           : *Null);
  /end-free
 
QCMDEXC is probably the one I've used most.
Allows you to run CL commands from an RPG program, like changing library lists or overriding files or submitting jobs...
 
As an alternative to QCMDEXC you can use QCAPCMD. It does exactly the same but it uses the API error structure to return any errors found while executing the command. My favorites are QDBRTVFD and QUSRMBRD which give you ALL of the information you would ever want about any physical file.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top