30
Mon, Dec
0 New Articles

Building the Bridge Between RPG IV and PC Programs

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

You don’t have to simulate PC applications in your 5250 RPG programs. Here’s a utility that will demonstrate how you can integrate executable PC programs using RPG IV.

“Fred, it’s come to my attention that the customer service department is failing to keep up with its workload. What are you going to do about it?”

“What do you mean, ‘What am I going to do about it?’ I’m a programmer, not the vice president of customer service! Shouldn’t this be his problem?”

“Normally, I’d have to agree with you, but the problem in this case is that the customer service reps are having to enter the customers’ orders on the AS/400 and then hot-key over to the word processing software on their PCs to enter the notes. This is eating up too much time.”

“Why are they doing that? We developed a really cool screen to enter their notes on the AS/400. It even does word wrapping! That’s what they should be using.”

“They claim it’s not good enough because they need to use special templates for their notes, and anyway, they can’t use those fancy fonts with your program the way they can with a PC package. Can’t you give them something on the AS/400 that will do the same thing as the PC program?”

That scenario isn’t really so far away from reality. After all, the users are going to use whichever tool they have available that best meets their needs. If it means having to maintain two systems, you can bet they’ll do it. What we need is an easy method for running PC applications from within RPG applications and then storing that data with the AS/400 database record. This article will present a utility that lets you write your own applications and take advantage of some of the AS/400’s new features. You’ll be able to

integrate your RPG IV applications more tightly with executable PC programs and the data they produce. Incidentally, if you want a native AS/400 word wrapper screen, check out the article “Word Wrap Utility” (MC, February 1998). This program is a great utility for handling text word wrapping, and it’s all ready for you to use with your own native applications. (It’s also the one I was poking fun at in the previous scenario!)

An Idea Is Born

This idea actually came about as a combination of two events. One was reading Ted Holt’s article “RPG IV and the IFS” (MC, December 1997). The other was a chance find on the Internet while doing research for another article. After reading Ted’s article, I was overwhelmed by the possibilities the Integrated File System (IFS) opened up to the AS/400 community. Imagine being able to read from and write to PC data files! I had that in the back of my mind as something to check into sometime when I came across a reference to a newly added piece of information in the QDCRDEVD API. This API returns device information such as name and device type. As of V3R2 and V3R7 of the operating system, it will also return the Internet Protocol (IP) address of remotely attached PCs. While it wasn’t exactly a lightbulb going off over my head, it did give me pause, and out of that, this utility was born.

Before We Get Started

For this utility to work, you will need to have the IBM Incoming Remote Command Server Daemon, CWBRXD.EXE, installed on your PC. This is installed automatically when Client Access/400 is installed. In addition, your AS/400 must be at V3R2, V3R7, or later. You may also need to install some PTFs, depending on the current

PTF level of your system. Refer to Figure 1 for a list of those PTFs.

What It Does

This utility demonstrates a customer information maintenance program. It is not intended as a ready-to-use application, although it could be with some minor tweaking. The user keys in a customer number and presses Enter on the first panel. He is presented with a panel to enter such relevant information as name, address, and credit limit. If he wants to enter notes for this customer, he indicates whether or not to retrieve previous notes (if any) from a folder on the AS/400 or from an AS/400 database. He can also select whether or not to save the notes in a database or inside a folder.

When the user presses the Enter key, he is presented with a window like the one shown in Figure 2. Here, he enters the drive where the notes should be created. This will be the letter of the drive that was mapped using the Windows 95/NT Map Network Drive function (more on this later). He also enters a file name, up to 10 characters, and selects the type of file it will be, either Rich Text Format (*.RTF) or plain text (*.TXT).

After pressing the Enter key, he sees the PC’s WORDPAD.EXE program open with a file of the name he selected, like the one shown in Figure 3. A previously existing file will be filled with the old data. If it’s a new file, the user will see a blank screen in which to begin text entry. He now types his notes and, when he’s done, saves the file just as he normally would any PC file—by clicking on File and Save on the toolbar. Control then returns to the AS/400 customer information screen, where the user presses the Enter key to save the record and move on to the next one.

Behind the Scenes

That’s what the user sees, and it’s pretty simple. Behind the scenes, however, a lot was going on:

• A folder on the AS/400 was mapped to a drive letter on the user’s PC when he first logged on.

• The IBM Incoming Remote Command Server Daemon (CWBRXD) was started when Windows 95/NT first started.

• The IP address of the PC was retrieved using the QDCRDEVD API.
• A stream file was opened or created in the IFS, using an external procedure call.
• If the user chose to retrieve note records from an AS/400 database, those records were read and then written to the stream file in the IFS, using an external procedure call.

• The file name and type (*.RTF or *.TXT) were used to build a PC command to start the WORDPAD.EXE program.

• The Run Remote Command (RUNRMTCMD) command was run using the QCMDEXC API. The IP address retrieved earlier was used as the destination of the command.

• When RUNRMTCMD was initiated, the command string parameter was passed to the Incoming Remote Command Server Daemon on the PC, where it was turned into an executable PC command.

• The WORDPAD.EXE program was opened with the file name chosen by the
• After the text was saved from WORDPAD on the PC, control returned to the AS/400 RPG IV program. If the user elected to save the data in a folder, processing returned to the customer information entry panel. If the user elected to save his data in an AS/400 database, external procedures were called to open the stream file, read from it, and write the data from the stream file to the AS/400. The final step then was to call the Unlink external procedure to delete the stream file from the directory it was created in.

OK, that’s a lot of information, so let’s take a closer look at the most important parts of the program logic. In order for this technique to work, you will need to take two steps on every PC that will use it: You must map a network drive, and you must set up the Incoming Remote Command Server to run every time Windows starts.

Mapping a network drive means that you want your PC to assign a drive letter to a folder on the AS/400. This is what we used to call shared folders under PC Support. To do this, right-click on the Network Neighborhood icon on your Windows 95/NT desktop and select Map Network Drive. You can also get to this by opening the Windows Explorer client and selecting Map Network Drive from the Tools dropdown menu.

You will be presented with a panel like the one shown in Figure 4. In this example, I mapped drive F to the base directory on MCRISC, the name of my AS/400. You can map it to any directory you want. (Caution: If you have a directory path other than HOME specified in your user profile, you should map the drive to that path.) If you check Reconnect at logon, this drive will map to this drive letter and directory every time Windows 95/NT starts.

The Incoming Remote Command Server program can be started in a couple of ways. This server program, by the way, was automatically placed in your C:WindowsSystem directory when Client Access/400 was installed. The name of the server program is CWBRXD.EXE. You can choose to use the Windows Explorer program to copy it into your Startup folder, where it will be executed each time Windows 95/NT starts, or you can set the Client Access properties to automatically accept incoming remote commands. To use the former method, open up Control Panel and double-click the Client Access icon. Click the Remote Command tab, and click the Automatically Start Incoming Remote Command box (see Figure 5). This will ensure that CWBRXD.EXE is called each time Windows 95/NT starts. You must also click on the Add button from this panel to add your default system information to the Remote Command Server Daemon. If

user.

On the PC

you already have a user ID and password specified here, you will need to change the RUNRMTCMD command string so it will pass the user ID and password to Windows 95/NT. If you are using the default for these parameters (i.e., asterisks in the fields), then you can leave the command string as it is.

Inside Your RPG IV Application

The RPG IV program used by this utility (see Figure 6) doesn’t do anything too much out of the ordinary, so I won’t spend a lot of time going over it. I basically used Ted’s routines, line for line, as he presented them in his “RPG IV and the IFS” article. I also reused his IFS prototypes copy book presented in the same article.

The changes I made were to combine them all into one program using subprocedures. I added one new external procedure, Unlink. This is also from the “UNIX- Type APIs” chapter in the API Reference manual that the other external procedures came from (Read, Write, Open, Close). Unlink is used to unlink, or delete, a stream file from the host. If you haven’t downloaded a copy of the IFSPROTOS copy book from MC’s Web site, you will need to. It is part of the “RPG IV and the IFS” utility example. You can find it in the December 1997 Downloadable Code section of MC’s Web site. Place it in a library or source file your RPG IV program can access during the creation process. The display file and physical files used to display and hold the data are shown in Figures 7 and 8.

The one really new function here is the use of the QDCRDEVD API to retrieve the IP address of the PC. You can see how this works in subprocedure RTVNETADS. I pass the device name of the PC, retrieved from the System Data Structure, to the procedure. The QDCRDEVD API is called using format DEVD0600. A whole wealth of information is returned in that format, but I am interested in only the IP address, so I substring it out of the receiver variable. It begins in position 877. The IP address is returned by the procedure, and it is used in the RUN_PC_CMD subroutine to build the RUNRMTCMD command string.

When the user saves the customer record, the path he keyed in on the prompt window is retained with the record. This serves two purposes: If the notes data was left in the stream file, there will be a path back to the file for access at a later time; and if the data was stored in a database, there will be a record of where the stream file was created. When the customer notes are displayed at some future time, that path will be used to fill in the prompt window, so a stream file of the same name can be created to place the notes into. To the user, it will appear as if the notes word processing file was there the entire time.

Stay in Step

One thing I want to point out is the syntax of the command string used to start the WORDPAD.EXE program. Notice that I used the START /w string before the path. I could have simply passed the WORDPAD path and program name to RUNRMTCMD, and it would have run fine. I chose to do it this way because, by using the /w parameter with the Windows 95/NT Start command, I am telling the PC to suspend all other applications from running while this program is running. In other words, the user will be input-inhibited on the AS/400 while entering text into the WORDPAD program.

This keeps the logical progression of tasks in sync for the user (i.e., start a new customer record, enter the notes, save the record). If the AS/400 task weren’t suspended, the PC program could be running independently of the AS/400 program and the data could get out of sync. You can experiment with this yourself by typing START /w and the path of one of your own PC programs from the Windows 95/NT Run command box. This is also a good way to make sure you specify the path name correctly.

The Key

In this example, I chose to use the WORDPAD word processing program and save my text as an *.RTF type. I did this so that, when I write the data back to an AS/400 database, all the special fonts and highlighting are preserved. If you look at that data record, you can see the text you typed surrounded by all the control information required by each font. While you can write some routines to strip those control characters off, it is easier to create the file as a *.TXT file type. This way, only text is stored in your database. It all depends on how you intend to use the data. You may simply want to store the data with the database record and use the WORDPAD.EXE program to display or print it so you can retain all special fonts and formatting.

What If You Don’t Use TCP/IP?

In this example, I used the RUNRMTCMD command to start the PC word processing program. The same technique can be used with the Start PC Command (STRPCCMD) for those PCs you have connected using twinax or other direct connections. In that case, you don’t need to retrieve the IP address. You will need to change the command literal to specify the correct parameters for STRPCCMD. They are different from RUNRMTCMD.

The World at Your Fingertips

I’ve only scratched the surface here, and I’m sure you can find many ways to enhance and improve on this idea. After all, you can do so much more than simply use a word processor. Although my example shows how to write text-only data, you can also use these techniques for reading from and writing to the IFS to read and write binary data. This will allow you to store images, spreadsheets, and wave files in the IFS.

Imagine bringing up a customer inquiry screen and seeing a photo of that customer along with hearing a voice recording and viewing personal information. How about storing sensitive financial spreadsheet information from Excel in an AS/400 database and using OS/400 object-level security to protect it? Let’s see a PC server match that level of security! The door is open to you. I am extremely interested in seeing what fantastic new uses you can come up with for this once you step through that door.

Referenc

e

s

AS/400 System API Reference V3R7 (SC41-3801, CD-ROM QBKAVD00) Network Station Support for Telnet (V3R2) (IBM APAR SA61841) Network Station Support for Telnet (V3R7) (IBM APAR SA61583)

V3R2 V3R7

SF38688 SF38357 SF38885 SF38535 SF38886 SF38536

Figure 1: You may need to install PTFs to get the new features of the QDCRDEVD API




Figure 2: The user selects a file name, drive letter, and file type for entering notes



Building_the_Bridge_Between_RPG_IV_and_PC___Programs06-00.png 900x497




Figure 3: The WORDPAD.EXE PC program



Building_the_Bridge_Between_RPG_IV_and_PC___Programs06-01.png 897x491





Building_the_Bridge_Between_RPG_IV_and_PC___Programs07-00.png 822x320

Figure 4: Mapping a network drive




Figure 5: The Client Access properties panel



Building_the_Bridge_Between_RPG_IV_and_PC___Programs07-01.png 585x622

*================================================================

* To Compile:

*

* CRTBNDRPG PGM(XXX/PC001RG) DFTACTGRP(*NO) BNDDIR(QC2LE)

*================================================================

FPc001df CF E Workstn

FCstmst UF A E K Disk

FCstnote UF A E K Disk

/copy xxx/ Qrpglesrc,ifsprotos

D Unlink PR 10i 0 ExtProc(‘unlink’)

D filename * value

D RtvNetAds PR 20A

D Device 10A CONST

D CrtBldIfs PR 12A

D FileName 12A CONST

D RdIfsFil PR 12A

D FileName 12A CONST

D Apost C Const(‘’’’)

D CodePage S 10u 0 inz(819)

D Cr C const(x’0D’)

D Create S 1A INZ(‘0’)

D Data_Rec S 256A

D Eol C Const(x’0D25’)

D Error_Flag S 1A INZ(‘0’)

D Extension S 4A INZ(‘.RTF’)

D File S 16

D FileName S 16

D File_Ext S 12A INZ

D File_Path S 16A INZ

D Fp S 10i 0

D I_Net_Adr S 20A Inz

D Lf C const(x’25’)

D N S 5 0

D Oflag S 10i 0

D Omode S 10u 0

D R S 5 0

D Rc S 10i 0

D RmtCmd S 150 INZ

D Rmt_Len S 15 5 INZ(150)

D Rmt_Lit1 C Const(‘RUNRMTCMD CMD(‘’’)

D Rmt_Lit2 C Const(‘’’) RMTLOCNAME(‘’’)

D Run_Cmd S 150 INZ

D Work150 S 150 INZ

D Wordpad_Lit C Const(‘Start /w C:Progra~1Access~1-

D Wordpad.exe’)

D SDS

D Device 244 253

** MAIN

*C Dow *In03 = *Off

C Exfmt Pc001

C If *In03 = *On

C Eval * Inlr = *On

C Return

C Endif

C If Cust# > 0

C Exsr Get_Cust

C Exsr Dtl_Scn

C Clear Cust#

C Endif

C Enddo

** Get_Cust - Get Customer Info

*C Get_Cust Begsr

C Eval Notes = ‘0’

C Eval Save = ‘1’

C Eval Doc_Typ = ‘2’

C Eval Create = *On

C Eval File_Name = *Blanks

C Eval File_Ext = *Blanks

C Cust# Chain Cstmst 99

C If *In99 = *Off

* .

* . Load Screen Fields From Database

* .

C Eval Drive = Note_Drive

C Eval File_Name = NFile_Name

C Eval Doc_Typ = NFile_Type

C Endif

C Endsr *---------------------------------------------------------

* Dtl_Scn - Display Detail Screen

*C Dtl_Scn Begsr

C Dow *In03 = *Off

*

C Exfmt Pc002

C If *In03 = *On Or *In12 = *On

C If *In03 = *On

C Eval * Inlr = *On

C Return

C Endif

C Leave

C Endif

*

C If Notes > ‘0’

* Retrieve IP Address

C Eval I_Net_Adr = RtvNetAds(Device)

C Eval I_Net_Adr = %trim(I_Net_Adr)

C Eval Run_Cmd = Wordpad_Lit

C Eval File_Path = ‘ ‘

C Exsr Window

C Eval Notes = ‘0’

C Else

C Exsr Del_Old_Rec

C If Save = ‘2’

C Eval Error_Flag = RdIfsFil( File_Ext)

C Endif

C Exsr Update_Rec

C Leave

C Endif

*

C Enddo

C Endsr

** Window - Display Path Window

*C Window Begsr

C Exfmt Pc00w1

C If *In12 = *Off

C If Doc_Typ = ‘1’

C Eval Extension = ‘.TXT’

C Else

C Eval Extension = ‘.RTF’

C Endif

C File_Name Cat Extension:0 File_Ext

C If Notes = ‘2’

C Eval Create = *On

C Endif

C Eval Error_Flag = CrtBldIfs( File_Ext)

* Build PC Command String

C If Error_Flag = *Off

C Eval File_Path = Drive + ‘:’ + File_Ext

C Run_Cmd Cat File_Path:1 Work150

C Eval Run_Cmd = % Triml(Work150)

C Exsr Run_PC_Cmd

C Endif

C Endif

C Endsr

** Run_Pc_Cmd - Run PC Command

*C Run_Pc_Cmd Begsr

C Rmt_Lit1 Cat Run_Cmd:0 RmtCmd

C Cat Rmt_Lit2:0 RmtCmd

C Cat I_Net_Adr:0 RmtCmd

C Cat Apost:0 RmtCmd

C Cat Apost:1 RmtCmd

C Cat ‘*IP’’)’:0 RmtCmd

C Call ‘QCMDEXC’

C Parm RmtCmd

C Parm Rmt_Len

C Endsr

** Upd_Rec - Add/Update Customer Info

*C Update_Rec Begsr

C Cust# Chain Cstmst 99

C Eval Cust_No = Cust#

* .

* . Load Database From Screen Fields

* .

C Eval NFile_Name = File_Name

C Eval NFile_Type = Doc_Typ

C Eval Note_Drive = Drive

*

C If *In99 = *Off

C Update Rcstmst

C Else

C Write Rcstmst

C Endif

C Endsr

** Del_Old_Rec - Delete Old Note Records

*C Del_Old_Rec Begsr

C Cust# Chain Cstnote 99

C Dow *In99 = *Off

C Delete Rcnote

C Cust# Reade Cstnote 99

C Enddo

C Endsr

** RtvNetAds - Subprocedure To Retrieve PC’s IP Address

*P RtvNetAds B Export

D RtvNetAds PI 20A

D Inp_Device 10A Const

D Apierr DS

D Bytprv 1 4B 0 Inz(216)

D Bytavl 5 8B 0 Inz

D Errid 9 15A Inz

D Rsvd 16 16A Inz

D Errdta 17 216A Inz

D Net_Address S 20A INZ

D Format S 8A Inz(‘DEVD0600’)

D Rcvar S 5000A Inz

D Varlen S 4B 0 Inz(5000)

C Eval Device = Inp_Device

C Call ‘QDCRDEVD’

C Parm Rcvar

C Parm Varlen

C Parm Format

C Parm Device

C Parm Apierr

C If BytAvl = 0

C Eval Net_Address = %Subst(Rcvar:877:16)

C Endif

C Return Net_Address

P RtvNetAds E

** CrtBldIfs - Subprocedure To Create/Build IFS File

*P CrtBldIfs B Export

D CrtBldIfs PI 12A

D FileName 12A Const

C Eval File = %trim(FileName) + x’00’

C If Create = *On

C Eval Oflag = O_Creat + O_Codepage +

C O_Rdwr

C Eval Omode = S_Irwxu + S_Iroth

C Eval Fp = Open(%addr(File): Oflag:

C omode: CodePage)

C Eval Rc = Close(Fp)

C Endif

C Eval Data_Rec = *Blanks

C Eval Oflag = O_Wronly + O_Textdata

C Eval Fp = Open(%addr(File): Oflag)

C If Fp < 0

C Eval Error_Flag = *On

C Return Error_Flag

C Endif

* Read File By Customer Number and Write To IFS File

C Cust# Chain Cstnote 99

C Dow *In99 = *Off

C Eval Data_Rec = Text + EOL

C Eval Rc = Write(Fp: %Addr(Data_Rec):

C %Len(%Trimr(Data_Rec)))

C Cust# Reade Cstnote 99

C Enddo

C Eval Rc = Close(fp)

C Return Error_Flag

P CrtBldIfs E

** RdIfsFil - Subprocedure To Read The IFS File & Build DB

*P RdIfsFil B Export

D RdIfsFil PI 12A

D FileName 12A Const

D CharsRead S 10i 0

D CurChar S 1

D Eof C const(x’00’)

C Eval Oflag = O_Rdonly + O_Textdata

C Eval File = %trim(FileName) + x’00’

C Eval Fp = open(%addr(File): Oflag)

C If Fp < 0

C Eval Error_Flag = *On

C Return Error_Flag

C Endif

C Eval R = 0

C Eval N = 0

C Eval Data_Rec = *Blanks

C Exsr GetChar

C Dow CurChar <> Eof

C Select

C When R = 256

C Exsr Write_Note

C Eval R = *zero

C Eval Text = *blanks

C When CurChar = Cr

C Exsr Write_Note

C Eval R = *zero

C Eval Text = *blanks

C When CurChar = Lf

C Exsr Write_Note

C Eval R = *zero

C Eval Text = *blanks

C Other

C Eval R = R + 1

C Eval %Subst(Text: R: 1) = CurChar

C Endsl

C Exsr GetChar

C Enddo

C Exsr Write_Note

C CallP Close(Fp)

* Remove File From Folder Using The Unlink Procedure

C CallP Unlink(%addr(File))

C Return Error_Flag

** GetChar - Process IFS Record, One Character At A Time

*C GetChar begsr

* If input buffer is empty, or all characters have been

* processed, refill the input buffer.

C If N = CharsRead

C Eval Data_Rec = *Blanks

C Eval CharsRead = Read(Fp:

C %Addr(Data_Rec): 256)

C Eval N = *Zero

C Endif

* Get the next character in the input buffer.

c If CharsRead <= 0

C Eval CurChar = Eof

C Else

C Eval N = N + 1

C Eval CurChar = % Subst(Data_Rec: N: 1)

C Endif

C Endsr

** Write_Note - Write Customer Note Record

*C Write_Note Begsr

C Eval Note_Cust# = Cust#

C Write Rcnote

C Endsr
P RdifsFil E

A****************************************************************

A*

A* To Compile:

A* CRTDSPF FILE(xxx/PC001DF) SRCFILE(xxx/QDDSSRC) +

A* SRCMBR(PC001DF)

A*

A****************************************************************

A DSPSIZ(24 80 *DS3)

A PRINT

A CA03(03 ‘EXIT’)

A CA12(12 ‘RETURN’)

A R PC001

A 1 4USER

A 1 27’Customer Master Update’

A DSPATR(HI)

A DSPATR(UL)

A 1 62DATE

A EDTCDE(Y)

A 3 4’Customer #...........:’

A CUST# 8Y 0B 3 28CHECK(FE ER)

A EDTCDE(Z)

A DSPATR(HI)

A 24 4’F3=Exit’

A COLOR(BLU)

A R PC002

A 1 4USER

A 1 27’Customer Master Update’

A DSPATR(HI)

A DSPATR(UL)

A 1 62DATE

A EDTCDE(Y)

A 3 4’Customer #...........:’

A CUST# 8Y 0O 3 28EDTCDE(Z)

A DSPATR(HI)

A 5 4’Name.................:’

A CFNAME 15A B 5 28DSPATR(HI)

A CLNAME 30A B 5 45DSPATR(HI)

A 6 4’Address Line 1.......:’

A CADRS1 40A B 6 28DSPATR(HI)

A 7 4’Address Line 2.......:’

A CADRS2 40A B 7 28DSPATR(HI)

A 8 4’City.................:’

A CCITY 40A B 8 28DSPATR(HI)

A 9 4’State................:’

A CSTATE 2A B 9 28DSPATR(HI)

A 10 4’Zip + 4..............:’

A CZIP 5Y 0B 10 28CHECK(RZ)

A EDTCDE(Z)

A DSPATR(HI)

A 10 34’-’

A CZIP4 4Y 0B 10 36CHECK(RZ)

A DSPATR(HI)

A 12 4’Telephone............:’

A TELE 10A B 12 28DSPATR(HI)

A 13 4’Fax..................:’

A FAX 10A B 13 28DSPATR(HI)

A 14 4’E-Mail...............:’

A EMAIL 40A B 14 28DSPATR(HI)

A 17 4’Credit Limit.........:’

A CRDLMT 16Y 0B 17 28CHECK(FE)

A CHECK(RZ)

A EDTCDE(Z)

A DSPATR(HI)

A 19 4’Customer Notes:’

A NOTES 1A B 19 21DSPATR(HI)

Figure 6: The RPG IV program

A VALUES(‘0’ ‘1’ ‘2’)

A 19 24’0=No Notes’

A 19 52’Save Notes In?:’

A SAVE 1A B 19 68DSPATR(HI)

A VALUES(‘1’ ‘2’)

A 19 70’1=Folder’

A 20 24’1=Get Notes From Folder’

A 20 70’2=Database’

A 21 24’2=Get Notes From Database’

A 24 4’F3=Exit’

A COLOR(BLU)

A 24 56’F12=Return/No Update’

A COLOR(BLU)

A R PC00W1

A WINDOW(*DFT 13 60)

A RMVWDW

A USRRSTDSP

A 2 14’Enter/Verify Notes File Path’

A DSPATR(HI)

A DSPATR(UL)

A 6 16’Drive Letter.:’

A DSPATR(HI)

A DRIVE 1A B 6 31

A 7 16’File Name....:’

A DSPATR(HI)

A FILE_NAME 8A B 7 31

A 8 16’File Type....:’

A DSPATR(HI)

A DOC_TYP 1A B 8 31

A 8 34’1=Text’

A 9 34’2=Rich Text Format’

A 11 3’F12=Return’

A COLOR(BLU)

***************************************************************

*

* To Compile:

* CRTPF FILE(xxx/CSTMST) SRCFILE( xxx/QDDSSRC) +

* MBR(CSTMST)

*

***************************************************************

A R RCSTMST TEXT(‘CUSTOMER MASTER’)

A CUST_NO 8 0 TEXT(‘CUSTOMER #’)

A FIRST_NAME 15 TEXT(‘FIRST NAME’)

A LAST_NAME 30 TEXT(‘LAST NAME’)

A ADDRESS_1 40 TEXT(‘ADDRESS LINE 1’)

A ADDRESS_2 40 TEXT(‘ADDRESS LINE 2’)

A CITY 40 TEXT(‘CITY’)

A STATE 2 TEXT(‘STATE’)

A ZIP 5 0 TEXT(‘ZIP’)

A ZIP4 4 0 TEXT(‘ZIP + 4’)

A TELEPHONE 10 TEXT(‘TELEPHONE #’)

A FAX_NO 10 TEXT(‘FAX NUMBER’)

A E_MAIL 40 TEXT(‘E-MAIL ADDRESS’)

A CREDIT_LMT 16 2 TEXT(‘CREDIT LIMIT’)

A NOTE_DRIVE 1 TEXT(‘DRIVE’)

A NFILE_NAME 8 TEXT(‘NOTES FILE NAME’)

A NFILE_TYPE 1 TEXT(‘DOCUMENT TYPE’)

*

A K CUST_NO

***************************************************************

*

* To Compile:

* CRTPF FILE(xxx/CSTNOTE) SRCFILE(xxx/QDDSSRC) +

* MBR(CSTNOTE)

*

***************************************************************

A R RCNOTE TEXT(‘CUSTOMER MASTER NOTES’)

Figure 7: Display file used by the RPG IV program

A NOTE_CUST# 8 0 TEXT(‘CUSTOMER #’)

A TEXT 256 TEXT(‘NOTE TEXT’)

*

A K NOTE_CUST#

Figure 8: Physical files used to store data for the RPG IV program

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • 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.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • 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

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • 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: