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



Hi

I have coded a program to use Remote SQL to get a record and pass it back in
a DS so that I can use the data to update a corresponding record in another
partition. This is a bit cumbersome and I was wondering if someone has a
better way of doing this.

Regards
Frank Kolmann

This is some example code

H OPTIMIZE(*NONE) OPTION(*NODEBUGIO) ALWNULL(*USRCTL)
H DFTACTGRP(*NO ) ACTGRP(*CALLER)

D DATA E DS EXTNAME(CNSHPS00)

D FUNC S 1
D RTN S 1
D STMT S 128
D KEY S LIKE(F_MV_CODE)

D UPDREC PR 1A
D IFUNC 1A
D IKEY 8A
D IDATA LIKE(DATA)


D GETREC PR 1A
D IFUNC 1A
D IKEY 8A
D IDATA LIKE(DATA)

D CNSHPS00 PR
D IFUNC 1A
D IKEY LIKE(F_MV_CODE)
D IDATA LIKE(DATA)
D CNSHPS00 PI
D IFUNC 1A
D IKEY LIKE(F_MV_CODE)
D IDATA LIKE(DATA)


/FREE
*INLR = '1';


FUNC = IFUNC;
DATA = IDATA;
KEY = IKEY ;
SELECT;

WHEN FUNC = 'G';
RTN = GETREC(FUNC : KEY: DATA);
IDATA = DATA;
ENDSL;
/END-FREE
* ***********************************************************


/SPACE 3

P GETREC B

* GET DATA

D WDATA E DS EXTNAME(CNSHPS00)
D WKEY S 8A

D GSTS S 1A
D STMT S 128A




D GETREC PI 1A
D GFUNC 1A
D GKEY LIKE(F_MV_CODE)
D GDATA LIKE(DATA)

/free
GSTS = *BLANK;
WKEY = GKEY;

EXEC SQL CONNECT TO PART2;
EXEC SQL SET CONNECTION PART2;
EXEC SQL SET SCHEMA = MYLIB;



STMT = ' SELECT * FROM CNSHPS00 WHERE F_MV_CODE ' +
' = '''+ GKEY +''' FOR FETCH ONLY';

EXEC SQL PREPARE S FROM :STMT;
EXEC SQL DECLARE IC CURSOR FOR S;
EXEC SQL OPEN IC;
EXEC SQL FETCH FROM IC INTO :WDATA;
EXEC SQL CLOSE IC;

EXEC SQL DISCONNECT PART2;
EXEC SQL CONNECT TO PART1;

GDATA = WDATA;

RETURN GSTS;
/end-free

P E

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.