星期四, 11月 09, 2023

2015-06-08 如何讓 WRKACTJOB 畫面中欄位 Function 更容易明瞭?(Command CHGFUNCNAM -- Change Function Name with QWCCCJOB Change Current Job API)


如何讓 WRKACTJOB 畫面中欄位 Function 更容易明瞭?(Command CHGFUNCNAM -- Change Function Name with QWCCCJOB Change Current Job API)

File  : QCLSRC

Member: CHGFUNCNAM

Type  : CLP

Usage : CRTCLPGM PGM(CHGFUNCNAM)   


/*-------------------------------------------------------------------*/
/*                                                                   */
/*  Program . . : CHGFUNCNAM                                         */
/*  Description : Change function name                               */
/*                with Change Current Job (QWCCCJOB) API             */
/*                which support change function name from V6R1       */
/*  Author  . . : Vengoal Chang                                      */
/*  Published . : AS400ePaper                                        */
/*  Date  . . . : June 8, 2015                                       */
/*                                                                   */
/*                                                                   */
/*  Program function:  Change function name command allows you to    */
/*                     change the description of the Function field  */
/*                     on WRKACTJOB to provide a better description  */
/*                     of what a job is doing.                       */
/*                                                                   */
/*                     The value on WRKACTJOB would appear as        */
/*                     USR-xxxx where xxxx is the 10 bytes specified */
/*                     on CHGFUNCNAM.                                */
/*                                                                   */
/*                     This program expects a single parameter       */
/*                     specifying the function name.                 */
/*                                                                   */
/*                                                                   */
/*  Compile options:                                                 */
/*    CrtClPgm    Pgm( CHGFUNCNAM )                                  */
/*                SrcFile( QCLSRC )                                  */
/*                SrcMbr( *PGM )                                     */
/*                                                                   */
/*-------------------------------------------------------------------*/
     Pgm    &FuncName

     Dcl    &FuncName       *Char     10
     Dcl    &ChgInf         *Char     22

     MonMsg      CPF0000    *N        GoTo Error

     ChgVar      %Bin( &ChgInf  1  4 )   1
     ChgVar      %Bin( &ChgInf  5  4 )   3 /* Function name */
     ChgVar      %Bin( &ChgInf  9  4 )  10 /* 10 byte */
     Chgvar      %Sst( &ChgInf 13 10 )  &FuncName

     Call        QWCCCJOB    ( &ChgInf x'0000000000000000' )

     Return

/*-- Error handling:  -----------------------------------------------*/
 Error:
     Call        QMHMOVPM    ( '    '                 +
                               '*DIAG'                +
                               x'00000001'            +
                               '*PGMBDY'              +
                               x'00000001'            +
                               x'0000000800000000'    +
                             )

     Call        QMHRSNEM    ( '    '                 +
                               x'0000000800000000'    +
                             )

 EndPgm:
     EndPgm



File  : QCMDSRC

Member: CHGFUNCNAM

Type  : CMD

Usage : CrtCmd      Cmd( CHGFUNCNAM )    
                    Pgm( CHGFUNCNAM  ) 
                    SrcFile( YourSourceFile )
                    Allow( *IPgm *BPgm )

/*  ===============================================================  */
/*  = Command....... ChgFuncNam                                   =  */
/*  = CPP........... ChgfuncNam CLP                               =  */
/*  = Description... Change Function Name                         =  */
/*  =                                                             =  */
/*  =                                                             =  */
/*  = CrtCmd      Cmd( ChgFuncNam )                               =  */
/*  =             Pgm( ChgFuncNam )                               =  */
/*  =             SrcFile( YourSourceFile )                       =  */
/*  =             Allow( *IPgm *BPgm )                            =  */
/*  ===============================================================  */
/*  = Date  : 2015/06/08                                          =  */
/*  = Author: Vengoal Chang                                       =  */
/*  ===============================================================  */
             Cmd        Prompt('Change Function Name')

             Parm       FuncName    *Char     10         +
                        Prompt('Function name')



File  : QCLSRC

Member: CHGFUNCTST

Type  : CLLE

Usage : CrtCmd      Cmd( CHGFUNCTST )    
                    Pgm( CHGFUNCTST  ) 
                    SrcFile( YourSourceFile )
        SbmJob      Cmd( Call CHGFUNCTST)
                    Job( CHGFUNCTST )
        WRKACTJOB press F10 see the job CHGFUNCTST Function name 
        will change STEP1, STEP2, STEP1, STEP2 ...					

/*-------------------------------------------------------------------*/
/*                                                                   */
/*  Program . . : CHGFUNCTST                                         */
/*  Description : Change function name Test                          */
/*  Author  . . : Vengoal Chang                                      */
/*  Published . : AS400ePaper                                        */
/*  Date  . . . : June 8, 2015                                       */
/*                                                                   */
/*                                                                   */
/*  Program function:  Change function name command test             */
/*                                                                   */
/*                                                                   */
/*  Compile options:                                                 */
/*    CrtBndCl    Pgm( CHGFUNCTST )                                  */
/*                SrcFile( QCLSRC )                                  */
/*                SrcMbr( *PGM )                                     */
/*                                                                   */
/*-------------------------------------------------------------------*/
Pgm

             Dcl   &SleepSec     *Int

             ChgVar     &SleepSec  1

Loop:
             ChgFuncNam FuncName(STEP1)

             CallPrc    PRC('sleep') Parm((&SleepSec *ByVal))

             ChgFuncNam FuncName(STEP2)

             CallPrc    PRC('sleep') Parm((&SleepSec *ByVal))

             Goto Loop

EndPgm
						
						


參照: Change Current Job (QWCCCJOB) API




沒有留言: