Ask the Expert

Fix the OPNQRYF statement

I need a field that is the substring of the original field but still have the same length in order for override to work. As an example, I can build a temporary access path for what I need using OPNQRYF,but I can't make it permanent because DDS does not allow me to define length for a field that is a SST of another field. Can you help?

 KEYFLD((*MAPFLD/fld1)) + 
 MAPFLD((fld1 '%SST(1/fld1 1 2)' *CHAR(6)) 
 CALL PGM(pgm1) 
 CLOF OPNID(file1) 

Without knowing more about your DDS and particular application, I'm not sure I can make a good suggestion about how to fix your OPNQRYF statement but it sounds as if you are only using the OPNQRYF to substring a new field from an existing field anyway. You can make a field in your logical file that is based on a substring of an existing field and then you could skip the OPNQRYF completely. Here is an example of how you would do that. In this example, field TSTSST is an input only field based on field TSTFUL that begins at position 4 of field TSTFUL and then uses 2 characters of the TSTFUL field.

A          R ILCTSTFM                  PFILE(TSTFIL)  
A            TSTFUL   
A            TSTNAM                                        A            TSTADR                         
A            TSTUSR                                       
A            TSTDAT                                       
A            TSTTIM                                       
A            TSTSST             I      SST(TSTFUL 4 2)     
A          K TSTSST                                       
A          K TSTUSR                                       
A          K TSTDAT                                       
A          K TSTTIM     


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in December 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

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
Sort by: OldestNewest

Forgot Password?

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

Your password has been sent to: