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.