Free software training Videos

Free software training Videos
https://www.youtube.com/user/VLRTraining

List Of Best WebSites

Tuesday 20 November 2012

%sst or %substring command in as400

it produces subset of existing string

The substring built-in function (%SUBSTRING or%SST) produces a character string that is a subset of an existing character string and can only be used within a CL procedure. In a CHGVAR command, the %SST function can be specified in place of the variable (VAR parameter) to be changed or the value (VALUE parameter) to which the variable is to be changed. In an IF command, the %SST function can be specified in the expression.










 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
        *************** Beginning of data *************************************
0001.00 PGM                                                                   
0002.00              DCL        VAR(&NAME) TYPE(*CHAR) LEN(20) VALUE('my +    
0003.00                           name is ramesh')                            
0004.00              CHGVAR     VAR(%SST(&NAME 12 7)) VALUE(KUMAR)            
0005.00              SNDPGMMSG  MSG(&NAME)                                    
0006.00 ENDPGM                                                                
        ****************** End of data ****************************************

OUTPUT

 ===> call clp008 
                  
 F3=Exit   F4=Promp
 F23=Set initial me
 my name is KUMAR  
**************************************************************************
a


WHat IS output OF this program  ?


Columns . . . :    1  71            Edit                     CHVRAMESH1/RAMESH
SEU==>                                                                  CLP008
FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
       *************** Beginning of data *************************************
001.00 PGM                                                                    
002.00              DCL        VAR(&NAME) TYPE(*CHAR) LEN(20) VALUE('my +     
003.00                           name is ramesh')                             
004.00              CHGVAR     VAR(%SST(&NAME 12 7)) VALUE(KUMAR)             
005.00              SNDUSRMSG  MSG(&NAME)                                     
006.00          IF         COND(%SST(&NAME 12 5) *EQ 'KUMAR')   +             
007.00                           THEN(CALL PGM(CLP003))                       
008.00 ENDPGM                                                                 
       ****************** End of data **************************************** 

No comments:

Post a Comment