Free software training Videos

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

List Of Best WebSites

Showing posts with label clp. Show all posts
Showing posts with label clp. Show all posts

Tuesday, 27 November 2012

data queue in as400

Data from a job can be transferd to another job using a data queue

CRTDTAQ

                           Create Data Queue (CRTDTAQ)                         
                                                                               
 Type choices, press Enter.                                                    
                                                                               
 Data queue . . . . . . . . . . . > DTAQ001       Name                         
   Library  . . . . . . . . . . .     *CURLIB     Name, *CURLIB                
 Type . . . . . . . . . . . . . .   *STD          *STD, *DDM                   
 Maximum entry length . . . . . . > 15            1-64512                      
 Force to auxiliary storage . . .   *NO           *NO, *YES                    
 Sequence . . . . . . . . . . . .   *FIFO         *FIFO, *LIFO, *KEYED         
 Include sender ID  . . . . . . .   *NO           *NO, *YES                    
 Queue size:                                                                   
   Maximum number of entries  . .   *MAX16MB      Number, *MAX16MB, *MAX2GB    
   Initial number of entries  . .   16            Number                       
 Automatic reclaim  . . . . . . .   *NO           *NO, *YES                    
 Text 'description' . . . . . . .   'first data q'                                     
                                                                               

RESULT

F23=Set initial menu                                    
Object DTAQ001 type *DTAQ created in library CHVRAMESH1. 
---------------------------------------------------------------------------------
Program for send and receives data from data queue.




Monday, 26 November 2012

CHGDTAARA in as400

The Change Data Area (CHGDTAARA) command changes the value of the local data area, the group data area, the program initialization parameter data area, or the specified data area stored in a library. This command does not change the data attributes or any of the object attributes of the data area. The new value must have the same type and a length less than or equal to the data area length or the specified substring length.

http://publib.boulder.ibm.com/html/as400/v4r5/ic2979/info/cl/chgdtaar.htm

---------------------------------------------------------

Example

ibm as400 online training

-----------------------------
 output
ibm as400 online training

DSPDTAARA in as400

The Display Data Area (DSPDTAARA) command shows the attributes and value of the specified data area. The following attributes are displayed: the type and length of the data area, the library where the data area is located (there is no library associated with a

http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fcl%2Fdspdtaara.htm

example:
type dspdtaara in command line press f4

online as400 training
 OUTPUT
online as400 training

CRTDTAARA in as400

The Create Data Area (CRTDTAARA) command creates a data area and stores it in a specified library. It also specifies the attributes of the data. The data area can also be initialized to a specific value.

for more info
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcrtdtaara.htm

example

1)Type crtdtaara in command line and press f4

you get this screen

clp online training








-----------

type data area name,type,initialvalue etc
press enter

 Selection or command                                                          
 ===> CRTDTAARA DTAARA(DTA002) TYPE(*CHAR) LEN(100) VALUE('chandana venkata rame
sh') TEXT('dta002 contains names')                                              

data area in as400

Data Area is a data storing file,one data area can store only one record of data, the size of Data area is 2048 bytes.The stored data is retrieved when ever is needed and where ever is needed.Data Area won't have source but by creation object will be created in the library.To see whether the data area is created or not use "WRKOBJPDM".


FOR more information

http://as400mani.blogspot.in/2012/01/data-area-in-as400.html




1.CRTDTAARA :For creation
2.DSPDTAARA :For display
3.CHGDTAARA :for adding and editing
4.RTVDTAARA :For retrieving data
5.DLTDTAARA :For deleting the data area

ESCAPE MESSAGE IN AS400

Escape (*ESCAPE): If the problem is serious enough, the program should abend (abend is short for abnormal end). If your CL program abends, it must send an escape message to its caller (the program that called it, or you yourself, if you initiated the program manually). When the caller gets the escape message it will know for sure that there was something seriously wrong,


FOR MORE INFORMATION
http://www.mcpressonline.com/system-administration/general/as400-messages-part-i.html

Sunday, 25 November 2012

monmsg in cl programmin

Monitor Message (MONMSG)

 

The Monitor Message (MONMSG) command is used to monitor escape, notify, and status messages sent to the program message queue of the program in which the command is used. Completion and diagnostic messages cannot be monitored.

Referance 

----------------------
 EXAMPLE-1
         *************** Beginning of data *****************************
0001.00 PGM                                                          
0002.00 CRTSRCPF FILE(A434567890)                                    
0003.00              MONMSG     MSGID(CPF7302) EXEC(GOTO CMDLBL(END1))
0004.00              SNDUSRMSG  MSG('physical file created')         
0005.00       /*       DLTF       FILE(A434567890)        */              
0006.00  END1:       ENDPGM                                          
        ****************** End of data ********************************

EXAMPLE-2
        *************** Beginning of data *************************************
0001.00 PGM                                                                    
0002.00              DCL        VAR(&A) TYPE(*DEC) LEN(3) VALUE(123)           
0003.00              DCL        VAR(&C) TYPE(*CHAR) LEN(5)                     
0004.00              DCL        VAR(&B) TYPE(*DEC) LEN(3)                      
0005.00              CHGVAR     VAR(&A) VALUE(&A / &B)                         
0006.00            MONMSG     MSGID(MCH1211) EXEC(CHGVAR VAR(&A) VALUE(1))     
0007.00              CHGVAR     VAR(&C) VALUE(&A)                              
0008.00              SNDUSRMSG  MSG(&C)                                        
0009.00              ENDPGM                                                    
        ****************** End of data **************************************** 

dltf command in as400

DLTF (Delete File)

The Delete File (DLTF) command can be used to delete files on the source and target servers.

Referance

screen

as400 online training
as400 online
 eaxmaple progaram

0001.00 PGM                                                          
0002.00 CRTSRCPF FILE(A434567890)                                    
0003.00              MONMSG     MSGID(CPF7302) EXEC(GOTO CMDLBL(END1))
0004.00              SNDUSRMSG  MSG('physical file created')         
0005.00              DLTF       FILE(A434567890)                     
0006.00  END1:       ENDPGM                                          


WRKSPLF COMMAND IN CL


The Work with Spooled Files (WRKSPLF) command allows the user to work with the spooled files on the system that meet the selection values specified by the SELECT keyword. You can either display or print all the spooled files on the system or a selected subset of them.



http://publib.boulder.ibm.com/html/as400/v4r5/ic2962/info/cl/wrksplf.htm

----------------------------------------------------------------------------------
                        Work with Spooled Files (WRKSPLF) 
                                                          
 Type choices, press Enter.                               
                                                          
 Select files for:                SELECT                  
   User . . . . . . . . . . . . .                *CURRENT 
   Print device . . . . . . . . .                *ALL     
   Form type  . . . . . . . . . .                *ALL     
   User data  . . . . . . . . . .                *ALL     
   ASP  . . . . . . . . . . . . .                *ALL     
 ASP device . . . . . . . . . . . ASPDEV         *        
 Output . . . . . . . . . . . . . OUTPUT         *        
                                                          


ADDMSGD COMMAND IN AS400

The Add Message Description (ADDMSGD) command describes a message and stores it in a message file for later use. The message description remains in the message file until the file is deleted or until the Remove Message Description (RMVMSGD) command is used to remove it from the file. To change any of the attributes of the message description, such as its message text or severity code, use the Change Message Description (CHGMSGD) command.

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fcl%2Faddmsgd.htm

                       Add Message Description (ADDMSGD)    
                                                            
Type choices, press Enter.                                  
                                                            
Message identifier . . . . . . . MSGID        > M000002     
Message file . . . . . . . . . . MSGF         > MSG001      
  Library  . . . . . . . . . . .                  *LIBL     
First-level message text . . . . MSG          > MSESSAGE3   
                                                            
                                                            
Second-level message text  . . . SECLVL       > 'MESSAGE4'  
                                                            
                                                            
                                                            
                                                            
                                                            
                                                            
 ...                                                        
Severity code  . . . . . . . . . SEV          > 11          


---------------------------------------------------------------
CLPROGRAM

0001.00 PGM                                                
0002.00              SNDUSRMSG  MSGID(M000002) MSGF(MSG001)
0003.00                                                    
0004.00 ENDPGM                                              

Saturday, 24 November 2012

CRTMSGF command in as400

CRTMSGF

The Create Message File (CRTMSGF) command creates a user-defined message file for storing message descriptions.

 referance
http://publib.boulder.ibm.com/html/as400/v4r5/ic2979/info/cl/crtmsgf.htm


----------------------------------------
                          Create Message File (CRTMSGF)      
                                                             
 Type choices, press Enter.                                  
                                                             
 Message file . . . . . . . . . . MSGF         > msg001         
   Library  . . . . . . . . . . .                  *CURLIB   
 Text 'description' . . . . . . . TEXT           'msg file'     
                                                             
                                                              

dclf command in as400

Declare File (DCLF)

 it is used for declare a device file such as disply file or database file

 

Parameters

Keyword Description Choices Notes
FILE File Qualified object name Required, Positional 1
Qualifier 1: File Name
Qualifier 2: Library Name, *LIBL, *CURLIB
RCDFMT Record format Single values: *ALL
Other values (up to 50 repetitions): Name
Optional, Positional 2
OPNID Open file identifier Simple name, *NONE Optional
ALWVARLEN Allow variable length fields *NO, *YES Optional
ALWNULL Allow field value of null *NO, *YES Optional
ALWGRAPHIC Allow graphic fields *NO, *YES Optional
DCLBINFLD Declare binary fields *DEC, *INT Optional

 

  Accessing the database using clp

1)using cl program we view the data in database file
2)we cannot delete update or write out to the file

eaxmple
      *************** Beginning of data **********
01.00 PGM                                        
02.00              DCLF       FILE(PF001)        
03.00              RCVF       RCDFMT(PF001R)     
04.00              SNDUSRMSG  MSG(&NAME)         
05.00              RCVF       RCDFMT(PF001R)     
06.00              SNDUSRMSG  MSG(&NAME)         
07.00 ENDPGM                                     
      ****************** End of data *************

Friday, 23 November 2012

RTVJOBA IN AS4OO

Retrieve Job Attributes 

 

  1. This command is valid only within a CL program or a REXX procedure. 

CL var for JOB          (10) . . JOB          > &NAME      
CL var for USER         (10) . . USER                      
CL var for NBR           (6) . . NBR                       
CL var for LOGLVL        (1) . . LOGLVL                    
CL var for LOGSEV      (2 0) . . LOGSEV                    
CL var for LOGTYPE      (10) . . LOGTYPE                   
CL var for LOGCLPGM     (10) . . LOGCLPGM                  
CL var for INQMSGRPY    (10) . . INQMSGRPY                 
CL var for OUTQ         (10) . . OUTQ                      
CL var for OUTQLIB      (10) . . OUTQLIB                   
CL var for ACGCDE       (15) . . ACGCDE                    
CL var for DATE          (6) . . DATE                      
CL var for SWS           (8) . . SWS          > &NAME1     
CL var for TYPE          (1) . . TYPE                      
CL var for RTNCDE      (5 0) . . RTNCDE                     
CL var for ENDSTS        (1) . . ENDSTS                   
CL var for RUNPTY      (2 0) . . RUNPTY                   
CL var for TIMESLICE   (7 0) . . TIMESLICE                
CL var for PURGE        (10) . . PURGE                    
CL var for DFTWAIT     (7 0) . . DFTWAIT                  
CL var for USRLIBL    (2750) . . USRLIBL                  
CL var for SBMMSGQ      (10) . . SBMMSGQ                  
CL var for SBMMSGQLIB   (10) . . SBMMSGQLIB               
CL var for PRTTXT       (30) . . PRTTXT                   
CL var for DDMCNV        (5) . . DDMCNV                   
CL var for BRKMSG        (7) . . BRKMSG                   
CL var for DATFMT        (4) . . DATFMT                   
CL var for DATSEP        (1) . . DATSEP                   
CL var for CURLIB       (10) . . CURLIB                   
CL var for PRTDEV       (10) . . PRTDEV                   
CL var for SYSLIBL     (165) . . SYSLIBL                  
CL var for CURUSER      (10) . . CURUSER                   
CL var for SUBTYPE       (1) . . SUBTYPE                   
CL var for PRTKEYFMT    (10) . . PRTKEYFMT                 
CL var for TIMSEP        (1) . . TIMSEP                    
CL var for TSEPOOL      (10) . . TSEPOOL                   
CL var for DEVRCYACN    (13) . . DEVRCYACN                 
CL var for STSMSG        (7) . . STSMSG                    
CL var for SRTSEQ       (10) . . SRTSEQ                    
CL var for SRTSEQLIB    (10) . . SRTSEQLIB                 
CL var for LANGID        (3) . . LANGID                    
CL var for CNTRYID       (2) . . CNTRYID                   
CL var for CCSID       (5 0) . . CCSID                     
CL var for JOBMSGQMX   (2 0) . . JOBMSGQMX                 
CL var for JOBMSGQFL    (10) . . JOBMSGQFL                 
CL var for DFTCCSID    (5 0) . . DFTCCSID                  
CL var for CYMDDATE      (7) . . CYMDDATE                  
CL var for DECFMT        (1) . . DECFMT                   
CL var for CHRIDCTL     (10) . . CHRIDCTL                 
CL var for ASPGRP       (10) . . ASPGRP                   
CL var for SPLFACN      (10) . . SPLFACN                  
CL var for DATETIME     (20) . . DATETIME                 
CL var for TIMZON       (10) . . TIMZON                   
CL var for TIMZONABBR   (10) . . TIMZONABBR               
CL var for TIMZONFULL   (50) . . TIMZONFULL               
CL var for TIMOFFSET    (3 0)  . TIMOFFSET                
CL var for THDRSCAFN    (20) . . THDRSCAFN                
CL var for RSCAFNGRP    (10) . . RSCAFNGRP        


example:

0001.00 PGM                                                        
0002.00              DCL        VAR(&NAME) TYPE(*CHAR) LEN(20)     
0003.00              DCL        VAR(&NAME1) TYPE(*CHAR) LEN(20)    
0004.00              RTVJOBA    JOB(&NAME) SWS(&NAME1)             
0005.00              SNDPGMMSG  MSG(&NAME *CAT &NAME1) TOPGMQ(*EXT)
0006.00              SNDPGMMSG  MSG(&NAME1) TOPGMQ(*EXT)           
0007.00 ENDPGM                                                             


 

operators in as400

  • Arithmetic operators (+, -, *, /)
  • Character operator (||, |>, |<)
  • Logical operators (&, |, ¬)
  • Relational operators (=, >, <, >=, <=, ¬=, ¬>, ¬<) 
a
(=, >, <, >=, <=, not symbol=, not symbol>, not symbol<) or their reserved values (*EQ, *GT, *LT, *GE, *LE, *NE, *NG, *NL).

*tcat in as400


*TCAT 
 
 
(concatenation with trailing blank truncation,)
 
 
symbol    operator  |<
TRUNCATED THE ALL TRAILING SPACES.
NO SPACE IS INCLUDED







0001.00 PGM                                                      
0002.00              DCL        VAR(&C) TYPE(*CHAR) LEN(20)      
0003.00              CHGVAR     VAR(&C) VALUE(' RAM    '|<'ESH') 
0004.00              SNDUSRMSG  MSG(&C)                          
0005.00 ENDPGM                                                  

output

RAMESH


WHAT IS OUT PUT FOR THIS PROGRAM

FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
       *************** Beginning of data ************************************
001.00 PGM                                                                  
002.00              DCL        VAR(&A) TYPE(*CHAR) LEN(30) VALUE('WELCOME + 
003.00                           TO AS400')                                 
004.00              DCL        VAR(&B) TYPE(*CHAR) LEN(30) VALUE('WELCOME + 
005.00                           TO JAVA')                                  
006.00              DCL        VAR(&C) TYPE(*CHAR) LEN(60)                  
007.00              CHGVAR     VAR(&C) VALUE(%SST(&A 1 16) *CAT (%SST(&B 12 +
008.00                           4)))                                       
009.00              SNDUSRMSG  MSG(&C)                                      
010.00 ENDPGM                                                               
       ****************** End of data ***************************************

*BCAT in as400

*BCAT 
 
 
                     *Concatenation with blank insertion,
 
 
It truncate all trailing blanks in first string .
but one blank is inserted.
 
 
oprator symbol     |>
 
 
0001.00 PGM                                                       
0002.00              DCL        VAR(&C) TYPE(*CHAR) LEN(20)       
0003.00              CHGVAR     VAR(&C) VALUE('    RAM    ' |> 'ESH')
0004.00              SNDUSRMSG  MSG(&C)                           
0005.00 ENDPGM                                       
 
OUTPUT
 
  RAM ESH     (one space between ram and esh)         

*cat in as400


The *CAT operator concatenates two character strings

operator symbol is     ||


EXAMPLE1:
  CHGVAR     VAR(&C) VALUE('RAM' *CAT 'ESH')
            output
RAMESH


EAMPLE2;
CHGVAR     VAR(&C) VALUE('RAM   ' *CAT 'ESH')

     OUTPUT
RAM  ESH ( 2 SPACES AFTER RAM)





Example:

0001.00 PGM                                                                 
0002.00              DCL        VAR(&A) TYPE(*CHAR) LEN(10) VALUE('ramesh') 
0003.00              DCL        VAR(&B) TYPE(*CHAR) LEN(10) VALUE('CHANDANA')
0004.00              DCL        VAR(&C) TYPE(*CHAR) LEN(20)                 
0005.00              CHGVAR     VAR(&C) VALUE(&a *cat &b)                   
0006.00              SNDUSRMSG  &C                                          
0007.00 ENDPGM  


OutPUT

Job 418467/CHVRAMESH/QPADEV0024 changed by JOBMANAGER.
ramesh    CHANDANA                                                   




_________USING OPERATOR  SYMBOL __________________
0001.00 PGM                                                                 
0002.00              DCL        VAR(&A) TYPE(*CHAR) LEN(10) VALUE('ramesh') 
0003.00              DCL        VAR(&B) TYPE(*CHAR) LEN(10) VALUE('CHANDANA')
0004.00              DCL        VAR(&C) TYPE(*CHAR) LEN(20)                 
0005.00              CHGVAR     VAR(&C) VALUE(&a *cat &b)                   
0006.00              SNDUSRMSG  &C                                          
0007.00              CHGVAR     VAR(&C) VALUE('  RAM   ' || ' ESH ')        
0008.00              SNDUSRMSG  &C                                          
0009.00 ENDPGM                                                                                                         

switch command in cl

The switch built-in function (%SWITCH) compares one or more of eight switches with the eight switch settings already established for the job and returns a logical value of '0' or '1'. The initial values of the switches for the job are determined first by the Create Job Description (CRTJOBD) command; the default value is 00000000.

0
The corresponding job switch is to be tested for a 0 (off).
1
The corresponding job switch is to be tested for a 1 (on).
X
The corresponding job switch is not to be tested


syntax
IF  COND(%SWITCH(0X111XX0))  THEN(GOTO C)
 
 
refer 
http://publib.boulder.ibm.com/infocenter/iadthelp/v6r0/index.jsp?topi
c=/com.ibm.etools.iseries.pgmgd.doc/evfclmst53.htm 

example

Thursday, 22 November 2012

%binary in as400

syntax

%BIN(character-variable-name starting-position length)
 
The binary built-in function (%BINARY or %BIN) interprets the contents of a specified CL character variable as a signed binary integer. The starting position begins at the position specified and continues for a length of 2 or 4 characters. 

Referance
 
 publib.boulder.ibm.com/infocenter/iadthelp/v6r0/
index.jsp?topic=/com.ibm.etools.iseries.pgmgd.doc/evfclmst51.htm


1)THIS COMMAND IS USED FOR CONVERTING X-DECIMAL VALUE TO EQVALENT DEC VALUE
 
  FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
        *************** Beginning of data *************************************
0001.00 PGM                                                                    
0002.00              DCL        VAR(&VAR1) TYPE(*CHAR) LEN(2) VALUE(X'000A')   
0003.00              DCL        VAR(&VAR2) TYPE(*DEC) LEN(3 0)                 
0004.00              CHGVAR     VAR(&VAR2) VALUE(%BIN(&VAR1))                  
0005.00              CHGVAR     VAR(&VAR1) VALUE(&VAR2)                        
0006.00              SNDUSRMSG  MSG(&VAR1)                                     
0007.00 ENDPGM                                                                 
        ****************** End of data ****************************************
 
 
OUTPUT
 
Job 414535/CHVRAMESH/QPADEV0029 changed by JOBMANAGER.
10 
 
 
 
 

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 ****************************************