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



NO! Don't clear the library QTEMP! It's not a future proof solution, you or some else will in 5 years time wonder why that new file is intermittently disappearing.

And why check if the file exists? If it did exist or not doesn't change the outcome of the DLTF command.


/Joakim

-----Original Message-----
From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Wren
Sent: den 15 februari 2013 11:14
To: Bare Metal Programming IBM i (AS/400 and iSeries)
Subject: Re: [C400-L] Creating temporary table

If you know there is nothing else in QTEMP that you want to keep you could just use the CLRLIB command to clear all objects from QTEMP at the start of your program.

Personally this is where I'd use a short CLLE module wrapper around the C module to use the best features of all available languages. Do the stuff that CL is good at (CHKOBJ, CRTDUPOBJ etc.) and then invoke the C function with a CALLPRC and bind the lot into a single program object.

Paul

-----Original Message-----
From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jevgeni Astanovski
Sent: 15 February 2013 09:07
To: c400-l@xxxxxxxxxxxx
Subject: [C400-L] Creating temporary table

Hello,

Such a trivial operation and I understood that I do not see simple solution...
A program needs to use a temporary table, I assumed that QTEMP is the best place for it.
So I have a table with the same structure in MYLIB and program needs to create its copy, however, empty, and in QTEMP.

I shall issue a CL command CRTDUPOBJ from my C program, but I cannot gurantee, that the table does not exist there already.
I see two ways to protect myself from this situation:

1. Capture relevant error message (probably CPD2104, object already
exist);

2. Issue unlink (Unix style API) to delete this file before making
CRTDUPOBJ - but this will end in error if file does not exist.

Or I should rather attempt to open file using _Ropen with mode "wr" and if it ends in error, issue CRTDUPOBJ and make _Ropen again?

All these methods seem odd - that made me think that maybe there is some better way...

Thanks,

Jevgeni

--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.

This e-mail message has been scanned and cleared by Postini / Google Message Security and the UNICOM Global security systems. This message is for the named person's use only. If you receive this message in error, please delete it and notify the sender.

--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.


________________________________

Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini Sverige AB, a company registered in Sweden (number 556092-3053) whose registered office is at Gustavslundsvägen 131 Box 825 – S-161 24 Bromma.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

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.