TechTalk: Determining the Number of Records

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

Determining the Number of Records

From: Mark Wheeler To: All

I need a program to provide a record count of a physical file member in batch. I have several that will throw a fancy interactive screen up with the record count, but I need one that will use the Send Program Message (SNDPGMMSG) command or write to a data area. I don't feel qualified to write this myself.

From: Ernie Malaga To: Mark Wheeler

Let's suppose your file is named ABC and it contains only one member (as all physical files typically do). Code your CL program as shown in 5.

Let's suppose your file is named ABC and it contains only one member (as all physical files typically do). Code your CL program as shown in Figure 5.

The Retrieve Member Description (RTVMBRD) command can retrieve a lot of information from a database file member into CL variables. Since it returns the number of records into a decimal variable, you must convert it to character before sending its value in a message; that's what the Change Variables (CHGVAR) command does. The two SNDPGMMSG commands I've listed are mutually exclusive. The first one sends the number of records (such as 0000078219) as the entire text of the message. The second SNDPGM-MSG sends a more explicit message, which may be more to your liking. Choose one.


TechTalk: Determining the Number of Records

Figure 5 How to Find Out the Number of Records

 DCL VAR(&NBRRCD) TYPE(*DEC) LEN(10 0) DCL VAR(&RECORDS) TYPE(*CHAR) LEN(10) RTVMBRD FILE(ABC) NBRCURRCD(&NBRRCD) CHGVAR VAR(&RECORDS) VALUE(&NBRRCD) SNDPGMMSG MSG(&RECORDS) / or SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('File ABC + contains' *BCAT &RECORDS *BCAT 'records') MSGTYPE(*INFO) 
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: