JCL to replace 1st 2 characters of all the records with 'YY'
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Input file
//SORTOUT DD DISP=OLD,DSN=Output file
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:C'YY',3:3,319)
Note: LRECL of Input file is 321.
Tuesday, September 15, 2009
Tuesday, July 21, 2009
REXX: Parsing a stream with a delimiter
PARSE VAR DSNAM QF1'.' QF2'.' QF3'.' QF4'.' QF5
Where DSNAM is a string with delimiter say 'ABCDE.DHIAH.KKKAL.ASAL.VVVV'
The delimiter here is '.' It could be '/' '-' etc
O/p:
QF1='ABCDE'
QF2='DHIAH'
QF3='KKKAL'
QF4='ASAL'
QF5='VVVV'
Where DSNAM is a string with delimiter say 'ABCDE.DHIAH.KKKAL.ASAL.VVVV'
The delimiter here is '.' It could be '/' '-' etc
O/p:
QF1='ABCDE'
QF2='DHIAH'
QF3='KKKAL'
QF4='ASAL'
QF5='VVVV'
Listing datasets - ISPF command
Initialises the list of datasets for a criterion:
"ISPEXEC LMDINIT LISTID(IDVAR) LEVEL("LEVELVAR")"
Where IDVAR is a variable to be used by the system to assign a name to the list initialised. LEVELVAR is a variable which holds the selection criteria. Ex: NFSK00.ABC*.KQLFR
Retrieve the list initialised:
"ISPEXEC LMDLIST LISTID("IDVAR") OPTION(LIST) DATASET(DSVAR)"
Where DSVAR is a variable which holds the current dataset in the list
After retrieving the ID variable IDVAR has to be freed:
"ISPEXEC LMDLIST LISTID("IDVAR") OPTION(FREE)"
If the ID variable is used so many times, say in a loop, it is advisable to initialise the variables IDVAR and DSVAR.
DROP IDVAR
DROP DSVAR
"ISPEXEC LMDINIT LISTID(IDVAR) LEVEL("LEVELVAR")"
Where IDVAR is a variable to be used by the system to assign a name to the list initialised. LEVELVAR is a variable which holds the selection criteria. Ex: NFSK00.ABC*.KQLFR
Retrieve the list initialised:
"ISPEXEC LMDLIST LISTID("IDVAR") OPTION(LIST) DATASET(DSVAR)"
Where DSVAR is a variable which holds the current dataset in the list
After retrieving the ID variable IDVAR has to be freed:
"ISPEXEC LMDLIST LISTID("IDVAR") OPTION(FREE)"
If the ID variable is used so many times, say in a loop, it is advisable to initialise the variables IDVAR and DSVAR.
DROP IDVAR
DROP DSVAR
REXX builtin function - WORDPOS
Returns the word position in a given string
WORDPOS(srch-str, str-srched,)
where
srch-str -> String to be searched
Str-srched -> String in which srch-str is searched for
Start pos -> start of search. This is optional and by default it is 0 i.e beginning of str-srched
Example:
WORDPOS('dog', 'barking dogs seldom bite')
--returns 2
WORDPOS('tide', 'time waits for none')
--returns 0
WORDPOS('be', 'To be or not to be',3)
--returns 6 since the search starts at 3rd word 'or'
WORDPOS(srch-str, str-srched,
where
srch-str -> String to be searched
Str-srched -> String in which srch-str is searched for
Start pos -> start of search. This is optional and by default it is 0 i.e beginning of str-srched
Example:
WORDPOS('dog', 'barking dogs seldom bite')
--returns 2
WORDPOS('tide', 'time waits for none')
--returns 0
WORDPOS('be', 'To be or not to be',3)
--returns 6 since the search starts at 3rd word 'or'
Thursday, November 06, 2008
Error message in IDCAMS step
1IDCAMS SYSTEM SERVICES 0 REPRO IFILE(INPUT) OFILE(OUTPUT) 0IDC3302I ACTION ERROR ON NWPOT010.IPS.OBGS709.CBS.CUR.G0002V00 IDC3321I ** OPEN/CLOSE/EOV ABEND EXIT TAKEN IDC31467I MAXIMUM ERROR LIMIT REACHED. 0IDC0005I NUMBER OF RECORDS PROCESSED WAS 716 0IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12
Cause:
In the input file, base gdg was given. Of the GDG generations, 1st generation was of wrong LRECL. Hence, error occurred at 2nd generation.
Thursday, August 14, 2008
PLI- %REPLACE
The %REPLACE statement allows you to program with named constants.
The %REPLACE statement has the form:
%REPLACE identifier BY constant;
Ex:
%REPLACE MAX BY 100;
The compiler replaces every occurrence of the given identifier in
the source text with the specified constant. The constant can be a
signed or unsigned arithmetic constant, a bit string, or a character
The %REPLACE statement has the form:
%REPLACE identifier BY constant;
Ex:
%REPLACE MAX BY 100;
The compiler replaces every occurrence of the given identifier in
the source text with the specified constant. The constant can be a
signed or unsigned arithmetic constant, a bit string, or a character
Subscribe to:
Posts (Atom)