Skip to content

Instantly share code, notes, and snippets.

@BirgittaHauser
Created December 15, 2023 07:02
Show Gist options
  • Save BirgittaHauser/9a81dd51f330068af33a818a9ef023fd to your computer and use it in GitHub Desktop.
Save BirgittaHauser/9a81dd51f330068af33a818a9ef023fd to your computer and use it in GitHub Desktop.
List Display File Information
Create Or Replace Function RtvDspFFldPos
(ParDspF VarChar(10),
ParDSpFLib VarChar(10) Default '*LIBL')
Returns Table (DSPF CHAR(10) ,
DSPFLIB CHAR(10) ,
Format Char(10) ,
ExtFldName CHAR(10) ,
Row SmallInt ,
Column SmallInt ,
LengthByte Integer ,
InpOutput Char(1))
Language SQL
Specific RtvDspFFfd
Not Deterministic
Modifies SQL Data
Called on NULL Input
Set Option COMMIT = *NONE ,
DBGVIEW = *SOURCE
Begin
Declare CLCMD VarChar (256) Not NULL Default '' ;
Declare Continue Handler For SQLException
Begin
Declare ErrText VarChar (128) Not NULL Default '' ;
Get Diagnostics Condition 1 ErrText = MESSAGE_TEXT;
Call SysTools.LPrintF(ErrText);
Signal SQLSTATE 'MY001' Set MESSAGE_TEXT = ErrText ;
END ;
Set ParDSPF = Upper(Trim(ParDspF));
Set ParDSPFLib = Upper(Trim(ParDspFLib));
Set CLCmd = 'DSPFFD FILE(' concat ParDspFLib concat '/' concat
ParDSpf Concat ') ' concat
' OUTPUT(*OUTFILE) ' concat
' OUTFILE(QTEMP/DSPFFD) ' concat
' OUTMBR(*FIRST *REPLACE)';
Call QCMDEXC(CLCmd, Length(CLCMD));
Return (Select WhFile, Whlib, WHNAME, WHFLDE, WHDROW, WHDCOL, WHFLDB, WHFIO
From QTEMP.DSPFFD a);
END ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment