Tuesday, December 29, 2009

LISTCAT command

To check if the PS file exists or not

You can check the existence of a file by LISTCAT cmd
//STEP005 EXEC PGM=IKJEFT01,DYNAMNBR=40,REGION=6144K
//ISPLOG DD DUMMY
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
LISTCAT ENTRIES ('File name')
/*
//COND01 IF STEP005.RC=0 THEN
****steps to be executed when the flat file exists****
// ENDIF
The JCL step STEP005 returns 0 if the file exists and 4 if not.

*******************************************************************
To check the availability of GDG versions

LISTCAT NONVSAM GDG LEVEL ('GDG base name')

Tuesday, September 15, 2009

Sort JCL - to replace 1st 2 characters

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, 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'

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

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'

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

Thursday, August 07, 2008

PLI - ONCODE built in function

The ONCODE built-in function provides a fixed-point binary value that depends on the cause of the last condition. If ONCODE is used out of context, zero is returned.

Syntax:
var=ONCODE ()

Thursday, January 24, 2008

What is CATMAINT utility

The CATMAINT utility updates DB2 catalog tables. This is generally run during migration. This utility can run only by the user who holds installtion SYSADM authority.

Thursday, December 27, 2007

IBM1936I S Invocation of compiler backend ended abnormally.

This is a severe error message issued while compiling a PL/1 pgm


Explanation:
The back end of the compiler either could not be found or else it detected an error from which it could not recover. The latter problem can sometimes occur, on Intel, if your disk is short of free space and, on the z/Series, if your job's region size is not large enough. Otherwise, report the problem to IBM.

Wednesday, December 26, 2007

REXX - TRACE command

TRACE is an interactive debugging facility

Syntax : TRACE

A - All => Traces all clauses before execution
C - Commands => Traces all commands before execution
E - Error => Traces any command resulting in an error
F - Failure => Traces any command resulting in a failure . This is same as 'Normal'.
I - intermediates => Traces all clauses along with the intermediate results during evaluation of expressions and substituted names
L - Labels => Traces any labels passes during execution
N - Normal => Traces any command resulting in a negative return code after execution. This is the default setting
O - Off => Traces nothing
R - Results => Traces all clauses before execution. Displays final results of evaluating an expression
S - Scan => Traces all remaining clauses in the data without them being processed

Prefix:

! - inhibits host command execution.
Ex: TRACE !C => Causes commands to be traced but not processed. As each cmd is bypassed, the REXX RC is set to zero. You can switch off command inhibition, when it is in effect, by issuing a TRACE instruction with a prefix "!."

? - Controls interactive debug.
During usual execution, a TRACE option with a prefix of ? causes interactive debug to be switched on.

How do I test a ISPF panel?

"Perform Dialog Testing" ==> "Dialog Services" ==> Execute the following commands

LIBDEF ISPPLIB DATASET ID ('PDS in which the panel is present')
ISPEXEC DISPLAY PANEL(Panel name)

ISRROUTE - ISPF command

The command is used in Panel design to invoke the SELECT service in the pull-down menu

ACTION RUN (ISRROUTE) PARM('SELECT CMD(panel name)')

Saturday, November 24, 2007

DB2 datatype - DATE

Date is a three part value (year , month and day)designating a point in time using the Gregorian calendar.
Range:
Year - 0001 to 9999
Month - 1 to 12
Date - 1 to 28 / 31/ 30 depending on the month

The internal represenation of date is a string of 4 bytes. Each byte consists of two packed decimal digits.
1st 2 bytes represent the year
3rd byte represents the month
4th byte represents the date

The length of a DATE column as described in the catalog is the internal length (4 bytes). The length of a DATE column as described in the SQLDA is the external length, which is 10 bytes unless a date-exit routine was specified when your DB2 system is installed. In that case, the string format of a date can be up to 255 bytes in length. Accordingly DCLGEN defines fixed-length string variables for DATE columns with a length equal to the value of the field LOCAL DATE LENGTH on installation panel DSNTIP4 or a length of 10- bytes if a value for the field was not specified

Wednesday, October 17, 2007

RECFM for Print files

FBA stands for Fixed Block Ansi. This means that the dataset is of Fixed block and contain ANSI printer carriage control character in the first position of the record. In MVS, we put the output-report to a file of format FBA and record length 133. Then, use the utility IEBGENER to print out the report.

Other record formats used for output-print datasets are FBM (Fixed block Machine: Has machine print-control codes), VBA(Variable block ANSI) and VBM (Variable block Machine).The one byte field in the first position of the dataset is used to tell the output device how to handle the output. The types of values it can contain are:
*Page feed / Form feed: Print after advancing to top-of-form
*Sigle space: Print after advancing one line
*Double space: Print after advancing 2 lines
*N spaces (N= 1 to 12): Print after advancing N lines
*Overstrike: Print after advancing no lines

Wednesday, August 22, 2007

COND=ONLY in JCL

//stepname EXEC PGM=x,COND=ONLY
The step is to be executed only if one or more of the preceding steps abnormally terminates. That is, the step will not be executed, unless a preceding step abnormally terminates.

COND=EVEN in JCL

//Stepname EXEC PGM=x,COND=EVEN
The step is to be executed even if one or more of the preceding steps abnormally terminates. That is, the step will always be executed, whether or not a preceding step abnormally terminates.

Friday, August 10, 2007

SQLCODE = 562

SQLCODE = 562, WARNING: A GRANT OF A PRIVILEGE WAS IGNORED BECAUSE THE GRANTEE ALREADY HAS THE PRIVILEGE FROM THE GRANTOR

Tuesday, August 07, 2007

Handling NULL in the program

Embedded SQL applications must prepare for receiving null values by associating a null-indicator variable with any host variable that can receive a null. A indicator variable is shared by both the database manager and the host application. Therefore, this variable must be declared in the application as a host variable, which corresponds to the SQL data type SMALLINT.

A null-indicator variable is placed in an SQL statement immediately after the host variable, and is prefixed with a colon. A space can separate the null-indicator variable from the host variable, but is not required. However, do not put a comma between the host variable and the null-indicator variable. You can also specify a null-indicator variable by using the optional INDICATOR keyword, which you place between the host variable and its null indicator.

The null-indicator variable is examined for a negative value. If the value is not negative, the application can use the returned value of the host variable. If the value is negative, the fetched value is null and the host variable should not be used. The database manager does not change the value of the host variable in this case.

Friday, July 27, 2007

Packed datasets

Packed data is data in which ISPF has replaced any repeating characters with a sequence showing how many times the character is repeated. Packing data allows you to use direct access storage devices (DASD) more efficiently because the stored data occupies less space than it would otherwise.

If the source data that you want to process is packed, it must be expanded before it can be successfully processed by any of the language processors. The expansion method you should use depends on whether your source data is:

=>A sequential dataset that contains expansion triggers:

An expansion trigger is a keyword that tells ISPF to expand additional data before copying, including or imbedding it in the source data. ISPF does not recognise expansion triggers in data stored as a sequential dataset. Therefore, for these types of datasets,

1. Manually expand the data: Edit the source data and enter PACK OFF
2. Select the Source Data Packed option before calling one of the language processors.

=>Either of the following:
A. A Sequential dataset that does not contain expansion triggers
B. Any member of a partitioned dataset, either with or without expansion triggers.

ISPF does recognize expansion triggers in data stored as members of a partitioned data set. Also, if your source data does not contain expansion triggers, you do not have to be concerned with them. Therefore, for these two types of data, select the Source Data Packed option before calling one of the language processors.