Active subsystems

310 pts.
AS/400 API
AS/400 subsystems
Hi, anyone pls let me know how to find the active subsystem. I found the API QWCLASBS. When I am trying to execute the api, I am getting the error.If you have any sample code to execute ths API, let us know.

 Pls advice on this.

Software/Hardware used:
AS400 subsystems

Answer Wiki

Thanks. We'll let you know when a new response is added.

Your general coding is proper. A specific change you need to make is to remove the quote marks:<pre>
&ERRCDE )</pre>
If you put quote marks around the variable names, they won’t be names any more.

I will assume that you have put proper values into the variables and that you created the user space before calling this API.

The DMPCLPGM is useful while testing. You might also want to use DMPOBJ to dump the user space after the API finishes.


Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    If you are getting an error, show how you defined the CALL to the API and how you defined the variables. Also tell us what error you are getting; that is, be sure to tell us the message identifier. I can probably show you examples, but you haven't told us what languages you know nor what version of i5/OS you use. There's no way to know if an example would be useful to you. If I spend half an hour putting an example together and you can't read it, it's a waste of time. Tom
    125,585 pointsBadges:
  • As400pgmmer
    Hi Tom, PGM DCL VAR(&USRSPN) TYPE(*CHAR) LEN(20) DCL VAR(&USRSPL) TYPE(*CHAR) LEN(10) DCL VAR(&FRMTNM) TYPE(*CHAR) LEN(8) + VALUE('SBSL0100') DCL VAR(&ERRCDE) TYPE(*CHAR) LEN(50) DCL VAR(&SBSDES) TYPE(*CHAR) LEN(10) DCL VAR(&SBSDSL) TYPE(*CHAR) LEN(10) CALL PGM(QWCLASBS) PARM('&USRSPN' '&FRMTNM' + '&ERRCDE') DMPCLPGM Endpgm This is the sample code, I had written to list the active subsystems. I corrected the error, I dint understood exactly that how this API will list the active subsystems. And the above program doesnt display anything. Thanks in advance
    310 pointsBadges:
  • As400pgmmer
    hi, I've not made much use of list API's, and I'm wrapping my head around retreival and presentation. So I dont have time to work on this API. I have another idea, but using API is better than creating a new object. I am looking for a sample code which will list down the active subsystems. If you have time and sample code, pls let me know. Yes, surely ur example would be very helpful to me. Because for finding GMT time also, I struck with those APIs . Your sample code helped me a lot. Now we had implemented TFRJOB with partial success, still some issues are going. So if you have any idea to list down the Active subsystems, let me know. And let me know, how to work with APIs, because I worked with very few APIs. And so I dont have more stuff on APIs. thanks Amutha
    310 pointsBadges:
  • TomLiotta
    Here's a basic CL program (V5R3 or higher) that should list active subsystems into a user space, extract *SBSD name and library from each entry in the list and display name of each one for 1 second. It finishes by dumping the user space to a spooled file, dumping the CLP variables and deleting the user space.
    /* API User Space Variables */
       dcl   &a_inl      *char     1     value( x'00' ) /* Initializer  */
       dcl   &a_siz      *int            value( 16384 ) /* Initial size */
       dcl   &offslst    *int            value( 1 ) /* Initial offset   */
       dcl   &nbrlste    *int
       dcl   &sizlste    *int            value( 150 ) /* Init entry sz  */
    /* General fields... */
       dcl   &i          *int                         /* Loop counter   */
       dcl   &us_hdr     *char   150                  /* Retrieved Hdr  */
       dcl   &SBSENT     *char  1000                  /* Retrieved Ent  */
       dcl   &usrspc     *char    10     value( 'ACTUPDSBSD' )
       dcl   &usrspclib  *char    10     value( 'QTEMP' )
       dcl   &qusrspc    *char    20
       dcl   &sbsd       *char    10
       dcl   &sbsdlib    *char    10     value( '*LIBL' )
       monmsg    ( cpf0000 mch0000 ) exec( goto STD_ERR )
    /* Create *usrspc for the SBS info APIs...                                   */
    /*   Active subsystems will be listed into the space. Basic info will be     */
    /*   retrieved from the space header and used to loop through entries...     */
    /* Set the qualified *usrspc name...                                         */
       chgvar     &qusrspc    ( &usrspc *cat &usrspclib )
       call  QUSCRTUS         ( +
                                &qusrspc                +
                                'ACTUPDSBSD'            +
                                &a_siz                  +
                                &a_inl                  +
                                '*ALL      '            +
                      'List active SBSDs                                 ' +
                                '*YES      '            +
                                x'0000000000000000'     +
    /* List the active SBSDs into our *usrspc...                                 */
       call       QWCLASBS     ( +
                                 &qusrspc    +
                                 'SBSL0100'  +
                                 x'00000000' +
    /* Set our loop control from the *usrspc headers...                          */
       call  QUSRTVUS         ( +
                                &qusrspc                +
                                &offslst                +
                                &sizlste                +
                                &us_hdr                 +
    /* Get the offset to the list within the space, the number   */
    /*   of list entries and size of each entry from the header. */
       chgvar    &offslst        %bin( &us_hdr    125 4 )
       chgvar    &nbrlste        %bin( &us_hdr    133 4 )
       chgvar    &sizlste        %bin( &us_hdr    137 4 )
    /* If no entries, then get out of here...                    */
       if  ( &nbrlste *eq 0 )     do
          sndpgmmsg  msgid( CPF9897 ) msgf( QCPFMSG ) +
                       msgdta( 'No active subsystems found.' )
          goto   End_ActSBS
    /* Set the offset to the list within the space...            */
       chgvar     &offslst     ( &offslst + 1 )
       dofor      &i  from( 1 ) to( &nbrlste )
    /* Retrieve a list entry...                                                  */
          call  QUSRTVUS         ( +
                                   &qusrspc                +
                                   &offslst                +
                                   &sizlste                +
                                   &SBSENT                 +
    /* Get the subsystem name and library from the list...                       */
          chgvar           &SBSD                 %sst( &SBSENT   1 10 )
          chgvar           &SBSDLIB              %sst( &SBSENT  11 10 )
             sndpgmmsg  msgid( CPF9897 ) msgf( QCPFMSG ) +
                          msgdta( 'Found' *bcat &SBSDLIB *tcat '/' *cat +
                          &SBSD ) +
                          topgmq( *EXT ) msgtype( *STATUS )
          dlyjob   ( 1 )
          chgvar     &offslst        ( &offslst + &sizlste )
       dmpobj      &usrspclib/&usrspc  objtypE( *USRSPC )
       dltusrspc   &usrspclib/&usrspc
       /* Move any *DIAG messages up the stack...        */
       Qsys/call       QSYS/QMHMOVPM       ( +
                                             '    '          +
                                             '*DIAG     '    +
                                             x'00000001'     +
                                             '*         '    +
                                             x'00000001'     +
                                             x'00000000'     +
       Qsys/monmsg     ( CPF0000 MCH0000 )
       /* Resend any *ESCAPE messages up the stack...     */
       Qsys/call       QSYS/QMHRSNEM       ( +
                                             '    '          +
                                             x'00000000'     +
       Qsys/monmsg     ( CPF0000 MCH0000 )
    It should compile and run on just about any system if you have the authority. It was created from a couple other pieces of code that I had, so it might look a little inconsistent. There shouldn't be anything that standard IBM documentation doesn't cover. Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

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

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: