| midrange.com code scratchpad | 
				
					| 
							
								| Name:Example: TCP status via QtocRtvTCPA | Scriptlanguage:Plain Text | Tabwidth:4 | Date:12/15/2011 12:11:28 am | IP:Logged |  | 
				
					| Description:The user was to lazy to give a description | 
				
					| Code: 
							
								
								
								| 
     /*+
 * Report status of tcp/ip +
 *+
 * CRTBNDCL PGM(TCPSTAT) DFTACTGRP(*NO) ACTGRP(*NEW) +
 *+
 **/
 pgm
 dcl &TCPA0100 *char 20
dcl &TCPA0100_L *int value( 20 )
 dcl &TCPA1100 *char 20
dcl &TCPA1100_L *int value( 20 )
 dcl &stack *char 10
dcl &status *int
  callsubr v4
callsubr v6
 return
   subr v4
     callprc 'QtocRtvTCPA'  parm( &TCPA0100 &TCPA0100_L 'TCPA0100' x'00000000' )
    chgvar &status %bin( &TCPA0100 9 4 )
    chgvar &stack 'TCP/IPv4'
    callsubr status
 endsubr
   subr v6
     callprc 'QtocRtvTCPA'  parm( &TCPA1100 &TCPA1100_L 'TCPA1100' x'00000000' )
    chgvar &status %bin( &TCPA1100 9 4 )
    chgvar &stack 'TCP/IPv6'
    callsubr status
 endsubr
   subr status
     if (&status = 0 ) do
        sndpgmmsg msgid(cpf9897) msgf(qcpfmsg) msgtype(*comp) msgdta(+
            'Inactive - The' +
            |> &stack |> +
            'stack is not operational.' +
            )
    enddo
    else if (&status = 1 ) do
        sndpgmmsg msgid(cpf9897) msgf(qcpfmsg) msgtype(*comp) msgdta(+
            'Active - The' +
            |> &stack |> +
            'stack is operational.' +
            )
    enddo
    else if (&status = 2 ) do
        sndpgmmsg msgid(cpf9897) msgf(qcpfmsg) msgtype(*comp) msgdta(+
            'Starting - The' +
            |> &stack |> +
            'stack not operational, but is in the process of starting.' +
            )
    enddo
    else if (&status = 3 ) do
        sndpgmmsg msgid(cpf9897) msgf(qcpfmsg) msgtype(*comp) msgdta(+
            'Ending, immediate - The' +
            |> &stack |> +
            'stack is operational, but is in the process of ending.' +
            )
    enddo
    else if (&status = 4 ) do
        sndpgmmsg msgid(cpf9897) msgf(qcpfmsg) msgtype(*comp) msgdta(+
            'Ending, controlled - The' +
            |> &stack |> +
            'stack is operational, but is in the process of ending.' +
            )
    enddo
 endsubr
 endpgm  |  | 
				
					|  |