Wednesday, January 19, 2011

ISPF - Find a member in a list of PDS from 3.4

ISPF

If we want to find a member but we don’t know the PDS to which it belongs. we only know the high level qualifier of the PDS.

Answer:

For example, let us consider high level Qualifier as MYID.MYAPPLN.* and member as MYMEM.

1. Go to 3.4 and list all PDS with MYID.MYAPPLN.*

2. Now issue, MEMBER MYMEM on the command line

ISRSUPC Utility

ISRSUPC Utility 

To search a word in PDS we have the option 3.14. The 3.14 option uses the utility ISRSUPC to search the elements.

Code:

//SEARCH  EXEC PGM=ISRSUPC,             
//            PARM=(SRCHCMP,            
//            'ANYC')                   
//NEWDD  DD DSN=File name (in which the word needs to be searched),  
//          DISP=SHR                    
//OUTDD  DD SYSOUT=(A)                  
//SYSIN  DD *                           
SRCHFOR  'Search word'                       
/*

Here the parameter ‘ANYC’(Any case) is for making it not case sensitive.
Any case. SuperC converts the lowercase alphabetic characters (a-z) in source data sets to uppercase (A-Z) before comparing the data sets (the actual input data sets are not modified). Use this option to cause strings such as "ABC", "Abc", "ABc", ... to compare equally.

It will return maxcc = 1, if it finds the text in the specified PDS, otherwise it return zero.    

DB2 function to change date formats

the query to change the date into different date formats  in DB2 using CHAR function as follows

SELECT CHAR(EMP_JOIN_DATE, USA) FROM EMP;

Other Formats are ISO(CCYY-MM-DD), USA(MM/DD/CCYY), EUR(DD.MM.CCYY) and JIS(CCYY-MM-DD)

Temporary VSAM

Allocation:
Temporary VSAM data sets can be allocated by specifying RECORG=KS/ES/LS/RR (RECORG keyword is the dynamic allocation parameter) along with other parameters of DD statement as follows:

1.      Syntax for temporary KSDS:

//SORTVSAM     EXEC PGM=SORT
//SYSOUT          DD  SYSOUT=*                                   
//SYSPRINT        DD  SYSOUT=*
//INDD1             DD  DSN=&INFILE,DISP=SHR
//OUTDD1          DD  DSN=&&OUTFILE,DISP=(,PASS),                     
//                             RECORG=KS,SPACE=(CYL,(25,50),RLSE),             
//                             LRECL=4000,AVGREC=K,KEYLEN=11,KEYOFF=0            
//SYSIN              DD  *
    SORT FIELDS=COPY
//*

Where:

LRECL=(Maximum record size), KEYLEN=(KSDS key length), KEYOFF=(KSDS key location), STORCLAS=TEMP

2.      Syntax for temporary ESDS/LDS/RRDS:

RECORG=ES/LD/RR,LRECL=(Record length), STORCLAS=TEMP

Restrictions:

1. Multivolume temporary VSAM data sets is not permitted.
2. Temp VSAM cannot be referred once a job is complete.

SORT syntax

1. SORT 
Syntax for a SORT to include specific records:

//STEP1            EXEC PGM=SORT
//SYSOUT          DD  SYSOUT=*                                   
//SYSPRINT        DD  SYSOUT=*
//SORTIN           DD  DSN=&INFILE,DISP=SHR
//SORTOUT         DD  DSN=&OUTFIL,
//                                              DISP=(NEW,CATLG,DELETE),
//                             SPACE=&SPACE            
//SYSIN              DD  *
    SORT FIELDS=COPY
       INCLUDE COND=(15,1, SS,EQ,C’A,B,C,D’)

//*


In ‘INCLUDE COND’ of SORT, syntax “,SS,” specifies a range for the required field condition separated logically by OR condition i.e. above ‘INCLUDE COND’ syntax is equivalent to:
                        INCLUDE COND=((15,1, CH,EQ,C’A’),OR,
                                                (15,1, CH,EQ,C’B’),OR,
                                                (15,1, CH,EQ,C’C’),OR,
                                                (15,1, CH,EQ,C’D’))