× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 29-Jul-2016 14:12 -0500, Booth Martin wrote:
I just saw the concern over updating a record. For that, the file
has to be marked for update, the record has to be read, and then
lines added to the output spec. Below is an example. I am sure there
is an error in assigning the right-side indicators, but you can see
where this is going. This would be a place where you would use MR
indicators to control the order of the READs and to determine if
there is an existing record to update; otherwise, add a record. But
matching record usage is not part of your question. (Please
understand, it has been 20+ years since I actually did this.):

FS36INP IP F 55 DISK
FS36OUT US F 55 DISK A

E ARRY 1 3 8
IS36INP 01
I 1 55 RCDINP
IS36OUT 02

C 01 MOVE ARRY,2 ARRY,3
C 02 SETON 71

OS36OUT D 02
O RCDINP 55
O ARRY,3 25
O DADD N71
O RCDINP 55
O ARRY,3 25

Apparently the designation (Desig=S) as secondary file along with File Addition (Add=A) on the F-spec is not compatible; msg QRG2174 "File-Addition entry of A invalid." And that invalidate the ADD in positions 16-18 of the O-spec; msg QRG6104"Output requested and File-Description specification differ. Lines ignored to next valid record type." Anyhow, I was not interested in figuring how to make the program function as\for Matched Records. Nevertheless, that source was enough to get me to try an Update-capable Primary file.

I was able to make the following RPG36 code [compiled as program UPDS36] function to update the records; though limiting the updates to the three records in the file having what is effectively CHGCOD=3 for the data copied from QCUSTCDT in QIWS into the file S36OUT. The Copy File (CPYF) is performed by the OCL code; that code follows the RPG source:

FS36OUT UP F 55 DISK
I* .1....+....2....+....3....+....4....+....5....+....6....+.
IS36OUT NS 73 48 D3
I 01 060CUSNUM
I 07 14 CUSNAM
I* 15 47 CUSXXX
I* 48 480CHGCOD
I* 49 55 BALXXX
IS36OUT NS 77
I 01 55 RCDINP
C* .1....+....2....+....3....+....4....+....5....+....6....+.
C 73 MOVEL'*NONAME*'CUSNAM
O* .1....+....2....+....3....+....4....+....5....+....6....+.
OS36OUT D 73
O CUSNUM
O CUSNAM


// FLIB QS36F,LIBL
// DLTF QS36F/S36OUT
// CRTPF QS36F/S36OUT RCDLEN(55)
// CPYF QIWS/QCUSTCDT QS36F/S36OUT FMTOPT(*NOCHK) +
MBROPT(*REPLACE) NBRRCDS(*END)
// LOAD UPDS36
// FILE NAME-S36OUT,DISP-OLD,LABEL-S36OUT
// RUN
// DSPPFM QS36F/S36OUT


The Display Physical File Member (DSPPFM) as the last request serves as an effective reporting tool to verify the results; that shows the expected changes:

*...+....1....+....2....+....3....+....4....+.≥%≤5....+
938472*NONAME*G K4859 Elm Ave DallasTX75217500030037000
839283Jones B D21B NW 135 StClay NY13041040010100000
392859Vine S SPO Box 79 BrotonVT05046070010439000
938485Johnson J A3 Alpine Way Helen GA30545999923987500
397267Tyron W E13 Myrtle Dr HectorNY14841100010000000
389572Stevens K L208 Snow PassDenverCO80226040010058750
846283*NONAME*J S787 Lake Dr Isle MN56342500030010000
475938Doe J W59 Archer Rd SutterCA95685070020250000
693829Thomas A N3 Dove CircleCasperWY82609999920000000
593029WilliamsE D485 SE 2 Ave DallasTX75218020010025000
192837Lee F L5963 Oak St HectorNY14841070020489500
583990*NONAME*M T392 Mill St Isle MN56342999930500000
****** END OF DATA ******


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.