Files-Sqlrpgle

285 pts.
Tags:
SQLRPGLE
******************************************************** C                   READ      OUTSRC               C                   EVAL      MBR  = mlname         C/EXEC SQL                                         C+ SELECT * FROM LIB/:MBR                          C/END-EXEC                                        ********************************************************* In above code MBR contains the file name. Is it possible to have Host variable for FILE NAME in above query?? In that above code Host variable for File name is not working… plz guide me and thanks in advance....

Software/Hardware used:
AS400

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Shyed,

Code looks good, Have you tried with the above code? Or, You just wants to confirm it before running?

Anyway, You can have the Host Variable for file name. The above SQL will work fine.

Pradeep.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • shyedajmal
    In that above code Host variable for File name is not working...
    285 pointsBadges:
    report
  • deepu9321
    If it is the case, You can use Dynamic SQL for executing the same. Using Dynamic SQL and preparing Cursor will be the advantageous method in this case. Because, You are trying to Retrieve the Data from MBR file, If this file holds more than one record, Static SQL will not work. You will need to mention the Work variables to which you will need to store the Resulting data. Pradeep.
    3,695 pointsBadges:
    report
  • TomLiotta
    Is it possible to have Host variable for FILE NAME in above query? No, because you are using static (compiled) SQL. Since SQL requires knowing the name of the file in order to compile the necessary references, you cannot have the name come from a variable. SQL cannot determine any meaning for "SELECT *" if it doesn't know what the file is. Can you describe the purpose of this program? Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    This would be a dynamic sql but ...we're concerned that you haven't looked downstream. Unless all the alternate files have the same file structure you are going to find that putting the result of the select into some fields or file structure and using that data will be difficult. Phil
    49,850 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following