I have certain users who never clean out their spool files. Is there any command I can run which will tell me how many spool files a user has out there? I am currently on version V5R4 of the operating system
Software/Hardware used:
v5r4
ASKED:
September 27, 2010 3:20 PM
UPDATED:
September 29, 2010 12:15 AM
Is there any command I can run which will tell me how many spool files a user has out there?
No, not unless you have created one. For most systems, that would be fairly easy.
Tom
An example program to retrieve the count of spooled files for a user:
pgm ( + &pUser + ) dcl &pUser *char 10 dcl &User *char 10 dcl &QOutQ *char 20 value( '*ALL' ) dcl &Form *char 10 value( '*ALL' ) dcl &UsrDta *char 10 value( '*ALL' ) dcl &UsrSpc *char 10 value( SLTSPLF ) dcl &UsrSpcLib *char 10 value( QTEMP ) dcl &QUsrSpc *char 20 dcl &us_hdr *char 150 dcl &nbrlste *dec ( 9 0 ) dcl &cNbrSplf *char 6 chgvar &User &pUser monmsg ( mch3601 ) exec( do ) rcvmsg msgtype( *LAST ) rmv( *YES ) monmsg ( cpf0000 cpf9999 mch0000 ) chgvar &User '*CURRENT' enddo chgvar &QUsrSpc ( &UsrSpc *cat &UsrSpcLib ) /* Create a user space... */ call QUSCRTUS ( + &QUsrSpc + 'SPLFLST ' + x'00001000' + X'00' + '*ALL ' + 'Temp list splfs ' + '*YES ' + x'00000000' + ) /* List user's spooled files into the space... */ call QUSLSPL ( + &QUsrSpc + 'SPLF0100' + &User + &QOutQ + &Form + &UsrDta + ) /* Retrieve the number of list entries from the space... */ call QUSRTVUS ( + &QUsrSpc + x'00000001' + x'00000096' + &us_hdr + ) /* A full space header was retrieved, but we only need this... */ chgvar &nbrlste %bin( &us_hdr 133 4 ) if ( &nbrlste *eq 0 ) do sndpgmmsg msgid( CPF9898 ) msgf( QSYS/QCPFMSG ) + msgdta( 'No spooled files found' ) enddo else do chgvar &cNbrSplf ( &nbrlste ) sndpgmmsg msgid( CPF9898 ) msgf( QSYS/QCPFMSG ) + msgdta( &User *bcat 'has' *bcat &cNbrSplf *bcat + 'spooled files' ) enddo Clean_up: dltusrspc &UsrSpcLib/&UsrSpc return endpgmCall it with a user profile name as a parm. If no parm is supplied, the program will default to ‘*CURRENT’.
Test it, modify it, do whatever you wish. Wrap it in a *CMD and set a return parm instead of a message. If you need info on the APIs, just search on their names in the Information Center.
Tom