Go4AS400-Image

The Web Ask Go4AS400
Share  
Homepage
See Sitemap
as400_FAQ
See Videos here
Contact me



Ü   SFLMSGKEY

 

·         This keyword is used at field level.

·         It is used in case of message subfile.

·         It is used as a message key that is used to identify a particular message that will be picked from the program message queue.

 

 

 

 

Ü   SFLMSGRCD

 

·         This keyword is used at field level.

·         It is used in case of message subfile.

·         It is used to prescribe the row number at which the message is to be displayed on the display screen.

·         In the example below the message will be displayed at row no. 23.

 

 

 

 

Ü   SFLPGMQ

 

·         This keyword is used to specify the message queue name which will be used as a subfile message queue.

·         All the messages will be send/retrieved from this message queue only.

 

 

 

Example

 

Below is the message file used in the program.

 

                          Display Message Descriptions                         

                                                             System:   SYSTEM09

 Message file:   AM_MSGF        Library:   AMIT                                

                                                                                

 Position to . . . . . . .             Message ID                              

                                                                               

 Type options, press Enter.                                                    

   5=Display details   6=Print                                                 

                                                                               

 Opt  Message ID  Severity  Message Text                                       

       MSG0001        1     ORG CODE CAN NOT BE BLANK                          

       MSG0002        0     THE ACCOUNT NUMBER CAN NOT BE BLANK                

       MSG0003        0     THE ACCOUNT CURRENCY CAN NOT BE BLANK              

       MSG0004        0     THE PARTY NUMBER CAN NOT BE BLANK                  

       MSG0011        0     THE ORGANISATION CODE SHOULD BE EITHER 190 191 192 

       MSG0012        0     THE ACCOUNT NUMBER SHOULD BE PREFIXED WITH A       

       MSG0013        0     THE CURRENCY CAN BE THEREE CHARACTER CODE e.g. EUR,

       MSG0014        0     THE PARTY NUMBER SHOULD START WITH PREFIX   'P'    

       MSG0015        0     'THE CURRENCY CAN BE'THREE'CHARACTER CODE e.g. EUR,

       MSG0099        0     ORGANISATION CODE, ACCOUNT NUMBER , CURRENCY AND PA

                                                                         Bottom

 F3=Exit   F5=Refresh   F12=Cancel                                              

                                                                               

 (C) COPYRIGHT IBM CORP. 1980, 2005.                                           

 

 

 

 

 

 

§  Below is the DDS of the display file created.

 

 

Columns . . . :    1  80                 Browse                          AMIT/QRPGLESRC

SEU==>                                                                        ACC_DSPFC

FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++

*************** Beginning of data *****************************************************

0001.00      A                                      DSPSIZ(24 80 *DS3)

0002.00      A                                      CA03(03 'EXIT')

0003.00      A                                      CA12(12 'PREVIOUS')

0004.00      A          R HEADER

0005.00      A                                  1 30'ACCOUNT ENTRY DISPLAY'

0006.00      A                                      DSPATR(HI)

0007.00      A                                      COLOR(BLU)

0008.00      A                                  4 25'ORG'

0009.00      A                                      DSPATR(HI)

0010.00      A                                      COLOR(BLU)

0011.00      A            S_ORG          3S 0B  4 35

0012.00      A                                      FLDCSRPRG(S_ACC)

0013.00      A  50                                  DSPATR(RI)

0014.00      A                                  5 25'ACC'

0015.00      A                                      DSPATR(HI)

0016.00      A                                      COLOR(BLU)

0017.00      A            S_ACC         12A  B  5 35

0018.00      A                                      FLDCSRPRG(S_CCY)

0019.00      A  51                                  DSPATR(RI)

0020.00      A                                  6 25'CCY'

0021.00      A                                      DSPATR(HI)

0022.00      A                                      COLOR(BLU)

0023.00      A            S_CCY          3A  B  6 35

0024.00      A                                      FLDCSRPRG(S_PARTY)

0025.00      A  52                                  DSPATR(RI)

0026.00      A                                  7 25'PARTY'

0027.00      A                                      DSPATR(HI)

0028.00      A                                      COLOR(BLU)

0029.00      A            S_PARTY       12A  B  7 35

0030.00      A  53                                  DSPATR(RI)

0031.00      A          R FOOTER

0032.00      A                                      OVERLAY

0033.00      A                                 22  5'F3 = EXIT'

0034.00      A                                      DSPATR(HI)

0035.00      A                                      COLOR(BLU)

0036.00      A                                 22 20'F12 = CANCEL'

0037.00      A                                      DSPATR(HI)

0038.00      A                                      COLOR(BLU)

0039.00      A          R ACCSFL                    SFL

0040.00      A                                      SFLMSGRCD(23)

0041.00      A            MSGKEY                    SFLMSGKEY

0042.00      A            PGMQ                      SFLPGMQ(10)

0043.00      A          R ACCCTL                    SFLCTL(ACCSFL)

0044.00      A                                      OVERLAY

0045.00      A                                      SFLDSP

0046.00      A                                      SFLDSPCTL

0047.00      A                                      SFLINZ

0048.00      A N03                                  SFLEND(*PLUS)

0049.00      A                                      SFLSIZ(0003)

0050.00      A                                      SFLPAG(0002)

0051.00      A            PGMQ                      SFLPGMQ(10)

****************** End of data ******************************************************

 

 

                                                                             

 

Write a program to demonstrate message subfile

 

Columns . . . :    6  80                  Browse                        AMIT/QRPGLESRC

SEU==>                                                                      ACC_RPGLEC

FMT H  HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

*************** Beginning of data ****************************************************

0001.00 HOPTION(*NODEBUGIO)                                                            

0002.00 H DEBUG(*YES)                                                                  

0003.00 FACC_DSPFC CF   E             WORKSTN                                          

0004.00 FACCOUNT   UF A E           K DISK                                              

0005.00 DS_MSG            S             30A                                            

0006.00 Dtime_is          S               z                                            

0007.00 Dtime_isO         S             20                                             

0008.00  *                                                                             

0009.00 DCURTIMSTP        DS                                                            

0010.00 DCURTIMDATE               1     16S 0                                          

0011.00 DCURRYEAR                 1      4S 0                                          

0012.00 DCURRMONTH                5      6S 0                                           

0013.00 DCURRDAY                  7      8S 0                                          

0014.00 DCURRHRS                  9     10S 0                                          

0015.00 DCURRMINS                11     12S 0                                           

0016.00 DCURRSECS                13     16S 0                                          

0017.00 C                   DOW       *IN03=*OFF                                       

0018.00 C   03              LEAVE                                                       

0019.00 C                   EXSR      VALIDATE                                         

0020.00  * IF S_MSG IS BLANK , THEN WRITE THE DATA TO PF                               

0021.00 C                   IF        S_MSG=*BLANKS                                    

0022.00 C                   EXSR      WRITEDATA                                        

0023.00 C                   ELSE                                                       

0024.00 C                   MOVEL     'MSG0099'     S_MSG                              

0025.00 C                   EXSR      SHOWMSG                                          

0026.00 C                   ENDIF                                                      

0027.00 C                   WRITE     HEADER                                           

0028.00 C                   WRITE     FOOTER                                           

0029.00 C                   WRITE     ACCCTL                                           

0030.00 C                   READ      HEADER                                           

0031.00 C                   EXSR      CLRMSGQ                                          

0032.00 C                   ENDDO                                                      

0033.00 C                   SETON                                        LR            

0034.00  *_____________________________________________________________________        

0035.00  *                                                                             

0036.00 C     VALIDATE      BEGSR                                                      

0037.00 C                   SETOFF                                       505152        

0038.00 C                   SETOFF                                       53            

0039.00 C                   IF        S_ORG=*ZEROS                                     

0040.00 C                   SETON                                        50            

0041.00 C                   MOVEL     'MSG0001'     S_MSG                              

0042.00 C                   EXSR      SHOWMSG                                          

0043.00 C                   MOVEL     'MSG0014'     S_MSG                              

0044.00 C                   EXSR      SHOWMSG                                          

0045.00 C                   ELSEIF    S_ACC=*BLANKS                                    

0046.00 C                   SETON                                        51            

0047.00 C                   MOVEL     'MSG0002'     S_MSG                              

0048.00 C                   EXSR      SHOWMSG                                          

0049.00 C                   MOVEL     'MSG0012'     S_MSG                              

0050.00 C                   EXSR      SHOWMSG                                          

0051.00 C                   ELSEIF    S_CCY=*BLANKS                                    

0052.00 C                   SETON                                        52            

0053.00 C                   MOVEL     'MSG0003'     S_MSG                              

0054.00 C                   EXSR      SHOWMSG                                          

0055.00 C                   MOVEL     'MSG0013'     S_MSG                              

0056.00 C                   EXSR      SHOWMSG                                          

0057.00 C                   ELSEIF    S_PARTY=*BLANKS                                   

0058.00 C                   SETON                                        53            

0059.00 C                   MOVEL     'MSG0004'     S_MSG                              

0060.00 C                   EXSR      SHOWMSG                                          

0061.00 C                   MOVEL     'MSG0014'     S_MSG                              

0062.00 C                   EXSR      SHOWMSG                                           

0063.00 C                   ELSE                                                       

0064.00 C                   MOVEL     *BLANKS       S_MSG                              

0065.00 C                   SETOFF                                       505152        

0066.00 C                   SETOFF                                       53            

0067.00 C                   ENDIF                                                      

0068.00 C                   ENDSR                                                       

0069.00  *____________________________________________________________________         

0070.00  *                                                                             

0071.00 C     WRITEDATA     BEGSR                                                       

0072.00 C                   EVAL      ORG=S_ORG                                        

0073.00 C                   EVAL      ACC=S_ACC                                        

0074.00 C                   EVAL      CCY=S_CCY                                        

0075.00 C                   EVAL      PARTY=S_PARTY                                    

0076.00 C                   EVAL      ACCSTS=2                                         

0077.00 C                   EVAL      ENTSTS=1                                         

0078.00 C                   EVAL      VERSTS=1                                         

0079.00 C                   EVAL      AUTSTS=1                                         

0080.00 C                   EVAL      RECSTS=2                                         

0081.00  * CALCULATE THE TIME FOR THE CURRENT SYSTEM DATE                              

0082.00 C                   EVAL      TIMESTP=%TIMESTAMP()                             

0083.00 C                   EVAL      TIME_IS=%TIMESTAMP()                             

0084.00 C                   EVAL      TIME_ISO=%char(TIME_IS:*iso0)                    

0085.00 C                   EVAL      CURRYEAR=%dec(%SUBST(TIMe_ISo:1:4):4:0)           

0086.00 C                   EVAL      CURRMONTH=%dec(%SUBST(TIMe_ISo:5:2):2:0)         

0087.00 C                   EVAL      CURRDAY=%dec(%SUBST(TIMe_ISo:7:2):2:0)           

0088.00 C                   EVAL      CURRHRS=%dec(%SUBST(TIMe_ISo:9:2):2:0)           

0089.00 C                   EVAL      CURRMINS=%dec(%SUBST(TIMe_ISo:11:2):2:0)         

0090.00 C                   EVAL      CURRSECS=%dec(%SUBST(TIMe_ISo:13:4):4:0)         

0091.00 C                   EVAL      OPENDT=%DEC(%editc(CURRYEAR:'X')+                

0092.00 C                                    %editc(CURRMONTH:'X')+                    

0093.00 C                                    %editc(CURRDAY:'X'):10:0)                 

0094.00 C                   WRITE     REC1                                             

0095.00 C                   EVAL      S_ORG =*ZEROS                                    

0096.00 C                   EVAL      S_ACC=*BLANKS                                     

0097.00 C                   EVAL      S_CCY=*BLANKS                                    

0098.00 C                   EVAL      S_PARTY=*BLANKS                                  

0099.00 C                   ENDSR                                                       

0100.00  *____________________________________________________________________         

0101.00  *                                                                             

0102.00 C     SHOWMSG       BEGSR                                                       

0103.00  * SEND MSG0001 FROM MESSAGE FILE CPF9898 TO PROGRAM MESSAGE QUEUE             

0104.00 C                   MOVEL     S_MSG         MSGID                              

0105.00 C                   MOVEL     'AM_MSGF'     MSGF                               

0106.00 C                   MOVE      'I'           MSGOPT                             

0107.00 C                   EXSR      SEND                                             

0108.00 C                   ENDSR                                                      

0109.00  * - - - - - - - - - - - - - - - --  - - - - - - -  -                          

0110.00 C     CLRMSGQ       BEGSR                                                      

0111.00 C                   MOVE      'C'           MSGOPT                             

0112.00 C                   EXSR      SEND                                             

0113.00 C                   ENDSR                                                      

0114.00  * - - - - - - - - - - - - - -  - - - - - - - - - - -                          

0115.00 C     SEND          BEGSR                                                       

0116.00 C                   CALL      'MSGSFLCL'                                       

0117.00 C                   PARM                    MSGID             7                

0118.00 C                   PARM                    MSGF             10                

0119.00 C                   PARM                    MSGOPT            1                

0120.00 C                   ENDSR                                                      

0121.00  *____________________________________________________________________         

0122.00 C     *INZSR        BEGSR                                                      

0123.00 C                   EVAL      PGMQ='ACC_RPGLEC'                                

0124.00 C                   WRITE     HEADER                                            

0125.00 C                   WRITE     FOOTER                                           

0126.00 C                   READ      HEADER                                           

0127.00 C                   ENDSR                                                       

****************** End of data *******************************************************

                                                                                                                                    

                                                               

 

ð  Below is the called program MSGSFLCL.

 

 

 

Columns . . . :    1  80                Browse                             AMIT/QRPGLESRC

SEU==>                                                                           MSGSFLCL

FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8

*************** Beginning of data *******************************************************

0001.01    PGM        PARM(&MSGID &MSGF &MSGOPT)

0002.00    DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)

0003.00    DCL        VAR(&MSGF) TYPE(*CHAR) LEN(10)

0004.00    DCL        VAR(&MSGOPT) TYPE(*CHAR) LEN(1)

0006.00

0007.00

0008.00    IF         COND(&MSGOPT *EQ 'I') THEN(SNDPGMMSG +

0009.00               MSGID(&MSGID) MSGF(&MSGF))

0010.00

0011.00    IF         COND(&MSGOPT *EQ 'C') THEN(RMVMSG PGMQ(*PRV +

0012.00                 (*)) CLEAR(*ALL))

0013.00 ENDPGM

****************** End of data *********************************************************

 

 

 

 

OUTPUT

 

Run the program ACC_RPGLEC

 

Below is the first screen that we see.

 

 

                             ACCOUNT ENTRY DISPLAY                             

                                                                               

                                                                               

                        ORG       ___                                             

                        ACC       ____________                                             

                        CCY       ___                                             

                        PARTY     ____________                                               

                                                                               

                                                                               

                                                                                

                                                                               

 

 

                                                                               

                                                                               

                                                                                

                                                                               

    F3 = EXIT      F12 = CANCEL    

                                           

 

                                                                                

                                                                               

Now without entering anything on this screen just press Enter. This will result into:

(a)    The first field ORG will be highlighted (RI) in reverse image.

(b)   Error message will display at the bottom with 2 additional messages.

(c)    Initially we can see only 2 message at the bottom as SFLPAG = 2

(d)   But when we put the cursor at PLUS sign at the bottom and press PAGE DOWN key, we see the 3rd message.

 

                             ACCOUNT ENTRY DISPLAY                             

                                                                               

                                                                                

                        ORG       ___                                             

                        ACC       ____________                       

                        CCY       ___                                  

                        PARTY     ____________                                      

                                                                               

                                                                               

                                                                                

                                                                               

 

 

                                                                               

                                                                                

                                                                               

                                                                               

    F3 = EXIT      F12 = CANCEL                                                

 ORG CODE CAN NOT BE BLANK                                                     

 THE PARTY NUMBER SHOULD START WITH PREFIX   'P'                              +

 

 

 

                             ACCOUNT ENTRY DISPLAY                             

                                                                            

                                                                               

                        ORG       ___                                             

                        ACC       ____________                            

                        CCY       ___                                             

                        PARTY     ____________                              

                                                                               

                                                                               

                                                                                

                                                                               

 

 

                                                                               

                                                                                

                                                                               

                                                                               

    F3 = EXIT      F12 = CANCEL                                                

 ORGANISATION CODE, ACCOUNT NUMBER , CURRENCY AND PARTY NUMBER ARE MANDATORY 

 

                                                                               

 

Now we enter the organization code in ORG field and then press Enter which result into:

(a)    The 2nd  field ACC will be highlighted(RI) in reverse image.

(b)   Error message will display at the bottom with 2 additional messages.

(c)    Initially we can see only 2 message at the bottom as SFLPAG = 2

(d)   But when we put the cursor at PLUS sign at the bottom and press PAGE DOWN key, we see the 3rd message.

 

 

                             ACCOUNT ENTRY DISPLAY                             

                                                                               

                                                                               

                        ORG       190                                          

                        ACC       ____________

                        CCY       ___

                        PARTY     ____________

                                                                               

                                                                                

                                                                               

                                                                               

                                                                                

                                                                               

                                                                               

                                                                               

                                                                               

                                                                               

                                                                               

    F3 = EXIT      F12 = CANCEL                                                

 THE ACCOUNT NUMBER CAN NOT BE BLANK                                           

 THE ACCOUNT NUMBER SHOULD BE PREFIXED WITH A                                 +

 

 

 

 

                             ACCOUNT ENTRY DISPLAY                             

                                                                               

                                                                               

                        ORG       190                                          

                        ACC       ____________

                        CCY       ___

                        PARTY     ____________

                                                                               

                                                                               

                                                                               

                                                                                

                                                                               

                                                                               

                                                                                

                                                                               

                                                                               

                                                                               

                                                                               

    F3 = EXIT      F12 = CANCEL                                                

 ORGANISATION CODE, ACCOUNT NUMBER , CURRENCY AND PARTY NUMBER ARE MANDATORY   

                                                                               

 


Comments:


Copyright © Go4as400.com, 2014. Copyright notice