Midrange News for the IBM i Community


Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Chicagoland
Do you Qualify Files to *CURLIB?
has no ratings.
Published: 28 Dec 2011
Revised: 23 Jan 2013 - 1729 days ago
Last viewed on: 18 Oct 2017 (3856 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Do you Qualify Files to *CURLIB? Published by: Bob Cozzi on 28 Dec 2011 view comments(7)

I'm running across several CL programs that clear "work" files or create work files if they don't exist. Those commands are qualified to *CURLIB.

Do others have this kind of situation? Are you using *CURLIB in production CL as a qualifier?

What if (A) there is no current library, or (B) you're in a test environment and you have the wrong current library?

I would have thought *LIBL (i.e., omitting the library) would have been a better choice. Seems like we made the decision back in the 1980's to not qualify things in general, and only qualify them when the proper testing/error trapping is in place.

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: DaleB
Premium member *
Reading, PA
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 20 hours 52 minutes ago

In general, don't do much with *CURLIB. We create all work files in QTEMP.

The only exception I can think of is when you start FTP, and if the default naming is 0 (lib/file), then the default "directory" is the current library (if no current library, then QGPL).

So if you CHGCURLIB before starting FTP, you don't need a "cd somelib" in the !--script--. If it's not in the !--script--, you don't need separate versions for each environment. Of course you you may want to put it back the way it was:

   DCL        VAR(&CURLIB) TYPE(*CHAR) LEN(10)
   RTVJOBA    CURLIB(&CURLIB)
   CHGCURLIB  CURLIB(somelib)
   FTP ...
   IF         COND(&CURLIB *EQ '*NONE') THEN(CHGCURLIB CURLIB(*CRTDFT))
   ELSE       CMD(CHGCURLIB CURLIB(&CURLIB))

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 20 hours 11 minutes ago

I agree. I think QTEMP is where "work" files should be placed.

Today, they create goofy named files with a 1, 2, 3, 4.... 99 suffix in *CURLIB.

Problem is, if they are on one of their other systems, they don't always have *CURLIB set to what they think it should be. So the default (QGPL) is used, and then the stuff that follows doesn't work.

FTP'ing isn't an issue since I installed the FTPFILE command.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 20 hours 8 minutes ago
Edited: Wed, 28 Dec, 2011 at 15:22:58 (2121 days ago)

Only time I use even set a *CURLIB is when I am about to run an SQL !--script-- from a source member - I don't qualify the SQL !--script-- for, say, create table - so I set the *CURLIB to where I want the table created at !--script-- run time.

The only other times I ever qualify anything is:

  1. QTEMP use - for WORK files!!
  2. Trash program to do single task multiple times - set up test environment, copy live file to test, etc.
Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 20 hours 5 minutes ago

I can see the point in having work files not in QTEMP - when you need to refer to content at a later time.  Though experience teaches that typically nobody cares what was in a work file, unless a program fails - you could always trap the error and call a routine to copy QTEMP files/dataareas/etc to a debug library for later referal.

Posted by: Viking
Premium member *
CA
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 16 hours 51 minutes ago

Agree, I never use curlib for production stuff.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 4 hours 21 minutes ago
Edited: Thu, 29 Dec, 2011 at 07:09:59 (2120 days ago)

Goofy named suffix hearkens back to of XYZ?WS? and it's ilk.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Do you Qualify Files to *CURLIB?
Posted: 5 years 9 months 21 days 2 hours 35 minutes ago

Dale, I think you're more accurate than you think. These were all legacy S/36 and S/36E guys who think how ever they do things is "correct" because they've decided its their standard.

A great example is source files. We create all new source files as RCDLEN(112). Yet the other day, I witnessed one of the lead developers copy our QRPGLESRC to a new source file. I asked about it, and he said he needed to convert an old RPGII/III program to RPG IV, and our source files were 80-byte long.

I said, no they are 112. His response was, right, but our standard is 120 so I created a new one at RCDLEN(120) because that way our comments will be preserved and we can continue to place our comments out to the right of the calc spec's.

Now, other than just being a goofy reason to do that (we don't use that area since moving to RPG IV) they also FTP source members between systems and use hand-written FTP !--script--s to do so. They always use ASCII transfer mode. And if you're transferring between source files and those source files have different lengths, you get "word wrapped" results.

I always use BINARY or IMAGE mode with FTP and avoid that issue, but nonetheless it is another example of S/36 developers who haven't taken the time to learn the system and are still programming like they did on S/36.  Cry