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



Chuck,



Even in S36 days many of us stayed away from the RPG Cycle for output.

It's just easier to have control in the C specs, using EXCPT opcode.

Not sure what you intend by "update"?



Jim Franz





C MOVE RCDINP RCDOUT 55

C EXCPT $UPD

C SETON LR

C* .1....+....2....+....3....+....4....+....5....+....6

OS36OUT EADD $UPD

O RCDOUT 55

**

COMPILE

TIME

ARRAY







-----Original Message-----

From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence

Sent: Thursday, July 28, 2016 8:57 PM

To: rpg400-l@xxxxxxxxxxxx

Subject: RPG36 with OCL examples desired; 1) insert-a-record 2)
update-that-record



I will include what I have attempted already, for reference; many would
find the Subject request to be improper, without showing some prior effort.
But any fully-functional but simple example-sources would be welcome, as
there is no specific reason the following code would need to be /corrected/.



The following OCL performs a setup for a RPG36 that will be called.

A file S36OUT is created, into which the row should be output\written.

Another file is created too, file S36INP, for possible use to obtain as data
in the program via a read, so that same data can be written to the S36OUT;
note however, that I really do not care if the data written is a literal or
that row data.



// FLIB QS36F,LIBL

// DLTF QS36F/S36INP

// DLTF QS36F/S36OUT

// CRTPF QS36F/S36INP RCDLEN(55)

// CRTPF QS36F/S36OUT RCDLEN(55)

// CPYF QIWS/QCUSTCDT QS36F/S36INP FMTOPT(*NOCHK) +

MBROPT(*REPLACE) NBRRCDS(1)

// LOAD INSS36

// FILE NAME-S36INP,DISP-OLD,LABEL-S36INP

// FILE NAME-S36OUT,DISP-OLD,LABEL-S36OUT

// RUN



Having tried to mimic [a poor excuse for] an example from the docs
showing some declarative that would enable copying data from one file to
another, I culled that example, and combined that with the QPROOF source
shipped in QS36SRC of #LIBRARY. I then created my program as

*CURLIB/INSS36 from the source member of the same name, but from file
QRPGSRC instead of QS36SRC from following source, compiled with a request
to:



CRTS36RPG *CURLIB/INSS36 SRCFILE(QRPGSRC) SRCMBR(INSS36)

OPTION(*SOURCE *SECLVL) GENOPT(*LIST) REPLACE(*YES)





FS36INP IP F 55 DISK

FS36OUT O F 55 DISK A

E ARRY 1 3 8

I* .1....+....2....+....3....+....4....+....5....+....6....+.

IS36INP XX

I 1 55 RCDINP

C MOVE ARRY,2 ARRY,3

C MOVE RCDINP RCDOUT 55

C SETON LR

C* .1....+....2....+....3....+....4....+....5....+....6

OS36OUT DADD

O LR RCDOUT 55

**

COMPILE

TIME

ARRAY





After invoking the program as loaded\run by the OCL, my output file
S36OUT has a blank record, followed by the expected record. Statement trace
seems to show the write at '.DRVFW02' occurring twice, but I have almost no
idea why, though possibly something to do with non-detail record output -- I
am really quite RPGII illiterate.



If I can finally get a sensible insert, then I want to get an update; I
have not even begun to delve into that.



--

Regards, Chuck



--

This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,

visit: http://lists.midrange.com/mailman/listinfo/rpg400-l

or email: RPG400-L-request@xxxxxxxxxxxx

Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



Please contact support@xxxxxxxxxxxx for any subscription related questions.


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.