Assign an alias to long SQL column names
search cancel

Assign an alias to long SQL column names

book

Article ID: 21142

calendar_today

Updated On:

Products

IDMS IDMS - Database

Issue/Introduction

Long SQL column names can present a problem to Culprit, since a null indicator is created by appending _NULL_IND to the end of the previously generated REC card name. Is there a way to avoid potential errors by using an AS clause to assign an alias to each SQL column?

Environment

Release: All supported releases.
Component: Culprit and SQL Option.

Resolution

Assign an ALIAS to the SQL column name using AS clause to rename the SQL column:

For example:

//SYSIN    DD *
INPUT  DB(Q)    DICTIONARY=APPLDICT    SCHEMA=DEMOEMPL
SQL SELECT "EMP_ID" AS "ID",
*           "EMP_FNAME" AS "FNAME",
*           "EMP_LNAME" AS "LNAME"
*    FROM EMPLOYEE
*    WHERE "EMP_ID" > 2000
*    ORDER BY ID;
0151*001  ID
0151*002  FNAME
0151*003  LNAME
/*

Please note that the alias names ID, FNAME, and LNAME can not be used on most clauses in the SQL statement (aliases are allowed on the ORDER BY clause). However, the aliases will be used to generate REC parameters, and must be used on all subsequent Culprit statements.

Generated REC Cards

Additional Information