Home
Services
Successes
Products
Assessments
Training
ASK/400
Contact Rome

ASK/400

ASK/400 is a forum where developers send us  technical questions about any aspect of the AS/400. Our experts respond to every question by e-mail, and we'll post questions with broader interest to this web page on a regular basis. There is no charge for this unique and helpful service!

Click here to submit your question via e-mail.


Q. How can I have optional and/or variable-length fields in a subfile?

A. Use SFLSIZ=SFLPAG to permit the use of indicator-conditioned fields.


Q. How do I put the system into a restricted state for backup or IPL?

A. ENDSBS(*ALL).  Note that this will end all active jobs and you can now only sign on at the system console.


Q. How can I identify the caller of the program that I'm running?

A. Call a CL program with 2 parms:

    PGM PARM(&PGM &PRVPGM)
  DCL &PGM    *CHAR 10 /* Your program's name (i/p PARM) */
  DCL &PRVPGM *CHAR 10 /* Your caller's name  (o/p PARM) */  
  DCL &MSGKEY *CHAR  4  
  DCL &SENDER *CHAR 80   

  SNDPGMMSG 'Dummy message to find previous program' +   
            TOPGMQ(*PRV &PGM) MSGTYPE(*COMP) +           
            KEYVAR(&MSGKEY)                              
  RCVMSG PGMQ(*PRV &PGM) MSGKEY(&MSGKEY) SENDER(&SENDER) 
  CHGVAR &PRVPGM %SST(&SENDER 56 10)

  RETURN

  ENDPGM

If you don't want to embed the name of your own program in the code, you can use the same technique to find your own name:  write one program that knows its own name, and call it.  It will then identify you to yourself:

  PGM (&PGM)   

  DCL &PGM  *CHAR 10              /* Returns your name */
  DCL &SELF *CHAR 10 'SELFID    ' /* Must be this program's name */

  /* "CALLERID" is the program described above */
  CALL CALLERID (&SELF &PGM)

  RETURN

  ENDPGM

[Home] [Services] [Successes] [Products] [Assessments] [Training] [ASK/400] [Contact Rome]