SELCOPY Logo

Frequently Asked Questions (FAQs)

As well as answers to general questions, the following FAQs may include solutions to problems that are not attributable to an error in the SELCOPY program and also problems for which a zap has not yet been published.




SELCOPY Batch

The following is a list of frequently asked questions that are answered at the SELCOPY query desk.

Can I run SELCOPY Interactively and get the output on my 3270 screen?

YES!

You can use SELCOPY Interactive (SELCOPYi) to run SELCOPY programs and all CBLVCAT commands interactively, and obtain the output in a 3270 Window.
SELCOPYi also allows you to perform most of your day-to-day work in a Windows-style mainframe environment.

Using SELCOPYi, you can edit multiple files, view the output of a number of CBLVCAT commands, debug a SELCOPY program, and more.. all at the same time!

How can I re-read a file when I've already hit end of file?

After testing for EOF, you can issue an explicit CLOSE for the file (or SQL query) and then re-open the file. This is shown in the example below.

NOTE Using STOPAFT 1 will allow the file to be re-read only once.

  RD INDD

  IF EOF INDD
    THEN CLOSE INDD STOPAFT 1
    THEN GG         STOPAFT 1
    THEN EOJ
    

Can SELCOPY process IAM and VSAM/T files?

Since both of these products are emulating VSAM, the files look just like VSAM files to SELCOPY. There is no special coding required.

Can I build and execute dynamic SQL in SELCOPY?

Yes. Build your SQL in the work area, and use "SQL=nnn AT ppp" to execute it. The example below shows how different SQL statements can be built and executed. The explicit OPEN and CLOSE are required to allow the 'file' SAMPSQL to be read multiple times.

  =BLD=
     IF no more SQL to build
       THEN EOJ
     ...
     ... Build SQL at pos ppp
     ...
     OPEN SAMPSQL SQL=nnn at ppp
     =RDT=
      READ SAMPSQL
      IF EOF SAMPSQL
        THEN CLOSE SAMPSQL
            THEN GOTO  BLD
     ...
     ... Process data
     ...
     GOTO RDT
    

My SQL query returned no rows, but SELCOPY gave a return code of 0. I was expecting a return code of 100 in the SQLCA, but that's also 0. What happened?

If you do not have an explicit OPEN and CLOSE for the query, SELCOPY's READ command performs an OPEN (and a CLOSE if no selections).

The SQL return code (SQLCA+12) indicates the return code from the most recent command (the CLOSE) and that is zero.

How can I move my SELCOPY DB2 SQL programs from development into production?

As long as the SQLID is the same, the only change required is to connect to a different DB2 subsystem.

This can be done either by using different "OPTION SSN=" parameter in your SELCNAM, including an "OPTION SSN=" card at the start of the SELCOPY code or changing the "SSN=" parameter on the READ operation.