Display Record Count

CL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Display Record Count (DSPRCDCNT) is a utility that shows the number of records in a file. This utility has some significant advantages over the method offered by OS/400.

To find out how many records are in a file using OS/400, you must use the Display File Description (DSPFD) command. The DSPFD command creates a spool file, allows you to view it, and then deletes the spool file. However, this method does not give you the ability to refresh the information on the screen. In order to do that, you must exit and then re-issue the command.

The DSPRCDCNT command does not create a spool file. Instead, it presents you with a pop-up window. Contained within the window is the file, library, and member name, as well as the number of active, deleted, and total records. The F5 key allows you to refresh the information.

This utility is useful not only for determining the number of records in a file, but also for monitoring the activity of files by watching how frequently the number of records change. It is also helpful for determining whether or not a file needs to be reorganized by analyzing the number of deleted records vs. the number of active records.

While programming this utility, I discovered a time-saving coding technique worth mentioning. When coding DDS specs for windows that are displayed over existing screens, I always used the OVRATR keyword on every output constant and valuable. What I discovered is that the OVRATR keyword can be specified at this record level saving quite a few keywords on a typical window type panel.


Display Record Count

Figure 1 Command DSPRCDCNT

 DSPRCDCNT: CMD PROMPT('Display Record Count') PARM KWD(FILE) TYPE(QUAL) PROMPT('File') PARM KWD(MBR) TYPE(*NAME) LEN(10) DFT(*FIRST) + SPCVAL((*FIRST)) PROMPT('Member') QUAL: QUAL TYPE(*NAME) LEN(10) MIN(1) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*LIBL)) PROMPT('Library') 
Display Record Count

Figure 2 CL program RCD001CL

 RCD001CL: + PGM PARM(&FILE &MBR) DCL VAR(&FILE) TYPE(*CHAR) LEN(20) DCL VAR(&LIB) TYPE(*CHAR) LEN(10) DCL VAR(&MBR) TYPE(*CHAR) LEN(10) DCL VAR(&ARCDS) TYPE(*DEC) LEN(10 0) DCL VAR(&DRCDS) TYPE(*DEC) LEN(10 0) DCL VAR(&MSG) TYPE(*CHAR) LEN(80) DCLF FILE(RCD001DF) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) CHGVAR VAR(&FILNAM) VALUE(%SST(&FILE 1 10)) CHGVAR VAR(&LIB) VALUE(%SST(&FILE 11 10)) LOOP: + RTVMBRD FILE(&LIB/&FILNAM) MBR(&MBR) RTNLIB(&LIBNAM) + RTNMBR(&MBRNAM) NBRCURRCD(&ARCDS) NBRDLTRCD(&DRCDS) CHGVAR VAR(&ACTRCD) VALUE(&ARCDS) CHGVAR VAR(&DLTRCD) VALUE(&DRCDS) CHGVAR VAR(&TOTRCD) VALUE(&ARCDS + &DRCDS) SNDRCVF IF COND(&IN03) THEN(GOTO CMDLBL(ENDPGM)) IF COND(&IN05 *EQ '1') THEN(GOTO CMDLBL(LOOP)) GOTO CMDLBL(ENDPGM) ERROR: + RCVMSG MSGTYPE(*ANY) MSG(&MSG) SNDPGMMSG MSG(&MSG) ENDPGM: + ENDPGM 
Display Record Count

Figure 3 Display file RCD001DF

 A DSPSIZ(24 80 *DS3) A CA03(03) A CA05(05) A R DSPDRCD A KEEP A ASSUME A OVERLAY A PUTOVR A OVRATR A 7 28' Record Count ' A DSPATR(RI) A 8 28' ' A DSPATR(RI) A 8 30'File....:' A FILNAM 10A O 8 40OVRDTA A 8 51' ' A DSPATR(RI) A 9 28' ' A DSPATR(RI) A 9 30'Library.:' A LIBNAM 10A O 9 40OVRDTA A 9 51' ' A DSPATR(RI) A 10 28' ' A DSPATR(RI) A 10 30'Member..:' A MBRNAM 10A O 10 40OVRDTA A 10 51' ' A DSPATR(RI) A 11 28' ' A DSPATR(RI) A 11 30'Active..:' A ACTRCD 8Y 0O 11 40EDTCDE(1) A OVRDTA A DSPATR(HI) A 11 51' ' A DSPATR(RI) A 12 28' ' A DSPATR(RI) A 12 30'Deleted.:' A DLTRCD 8Y 0O 12 40EDTCDE(1) A OVRDTA A 12 51' ' A DSPATR(RI) A 13 28' ' A DSPATR(RI) A 13 30'Total...:' A TOTRCD 8Y 0O 13 40EDTCDE(1) A OVRDTA A 13 51' ' A DSPATR(RI) A 14 28' F3=Exit F5=Refresh ' A DSPATR(RI) 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: