This is a tool that will compare two physical files and report common fields. This is useful when a program uses two files and you need to check which fields could potentially be overwritten in the program.
The format of the command is:
Display Duplicate Field Names (DSPDUPFD)
Type choices, press Enter.
File #1 . . . . . . . . . . . . mscmp100 Name
Library . . . . . . . . . . . v84flive Name, *LIBL, *CURLIB
File #2 . . . . . . . . . . . . obcop100 Name
Library . . . . . . . . . . . v84flive Name, *LIBL, *CURLIB
Output . . . . . . . . . . . . . * *PRINT, *
which would produce:
Line ....+....1....+....2....+....3....+....4....+....5..
000001 Field ACTIV exists in MSCMP100 and OBCOP100
000002 Field CMPNO exists in MSCMP100 and OBCOP100
000003 Field PLTNO exists in MSCMP100 and OBCOP100
000004 Field CUSNO exists in MSCMP100 and OBCOP100
Code: DSPDUPFD (CL)
/**************************************************************/
/* Program: DSPDUPFD MARTIN CUBITT - KEYMED LTD. */
/**************************************************************/
PGM PARM(&F1 &F2 &OP)
DCL VAR(&F1) TYPE(*CHAR) LEN(20)
DCL VAR(&F2) TYPE(*CHAR) LEN(20)
DCL VAR(&IP) TYPE(*CHAR) LEN(10)
DCL VAR(&FN1) TYPE(*CHAR) LEN(10)
DCL VAR(&FN2) TYPE(*CHAR) LEN(10)
DCL VAR(&LN1) TYPE(*CHAR) LEN(10)
DCL VAR(&LN2) TYPE(*CHAR) LEN(10)
DCL VAR(&OP) TYPE(*CHAR) LEN(10)
DCL VAR(&OUTPUT) TYPE(*CHAR) LEN(10)
/* Extract names and libraries from parameters */
CHGVAR VAR(&FN1) VALUE(%SST(&F1 1 10))
CHGVAR VAR(&LN1) VALUE(%SST(&F1 11 10))
CHGVAR VAR(&FN2) VALUE(%SST(&F2 1 10))
CHGVAR VAR(&LN2) VALUE(%SST(&F2 11 10))
IF COND(&OP = '*') THEN(CHGVAR VAR(&OUTPUT) +
VALUE('*DISPLAY'))
IF COND(&OP = '*PRINT') THEN(CHGVAR +
VAR(&OUTPUT) VALUE('*PRINTER'))
DSPFFD FILE(&LN1/&FN1) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DSPFFD1)
DSPFFD FILE(&LN2/&FN2) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DSPFFD2)
RUNQRY QRY(DSPDUPFDQ) OUTTYPE(&OUTPUT)
RETURN
ENDPGM
DSPDUPFD (CMD)
/**************************************************************/
/* Command: DSPDUPFD - DISPLAY DUPLICATE FIELD NAMES */
/* AuThOr: MARTIN CUBITT */
/**************************************************************/
CMD PROMPT('Display Duplicate Field Names')
PARM KWD(FILE1) TYPE(Q1) MIN(1) PROMPT('File #1')
PARM KWD(FILE2) TYPE(Q1) MIN(1) PROMPT('File #2')
PARM KWD(OUTPUT) TYPE(*CHAR) LEN(10) RSTD(*YES) +
DFT(*) VALUES(*PRINT *) MIN(0) +
PROMPT('Output')
Q1: QUAL TYPE(*NAME) LEN(10)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) SPCVAL((*LIBL +
'*LIBL') (*CURLIB '*CURLIB')) +
PROMPT('Library')
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
This was first published in November 2001