260 pts.
 AS/400 Query
I have to run a Query based on PF without DDS with record leghth 2997. I have to select Company Code '01' which is the 925-927 positions in the file. How do I do select in the Query? Please advice. Thank you.

Software/Hardware used:
AS/400
ASKED: May 12, 2010  4:44 PM
UPDATED: May 14, 2010  10:29 PM
  Help
 Approved Answer - Chosen by ITKE

Non-DDS files actually has a filename for the whole record. Find your file's fieldname using this command, which uses query/400:

runqry *n mylib/myfile

The fieldname to use in your query will be the heading-name (propably F00001..).

Now create your query making a resultfield : enter a resultfieldname, fx COMPCOD, and enter this expression

substr(F00001, 925, 3)

Then enter some selection in your query, and VOILA.... :-)

I hope thisworks for you
DanF

ANSWERED:  May 13, 2010  3:53 PM (GMT)  by ITKE

 
Other Answers:

I’m not sure if query will work with a file that long
However, you would make a result field using substr to get the company
Then use the result field in the select record option.

But you say Company Code ’01′ which is the 925-927 — 925-927 is three characters wide?

Phil

Last Wiki Answer Submitted:  May 13, 2010  1:59 am  by  philpl1jb   44,150 pts.
Latest Answer Wiki Contributors:  philpl1jb   44,150 pts.
To see other answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thank you. The Company Code is ’001′. But who to create substring if there no fields names?

 260 pts.

 

Thank you Dan, it worked and It is so simple…

 260 pts.

 

Look to see if the file contains a System 36 IDDU (Interactive Data Definition Utility) layout. If so then link the file using this utility and suddently you have a file layout. If you do not have a layout then make one using this utility and link the file and now you have the file layout that can be used for more than one field of information.

As well IDDU allows you to have multiple layouts for a file.

 195 pts.

 

…System 36 IDDU (Interactive Data Definition Utility)…

For those unfamiliar, the STRIDD command can give you initial access to IDDU. There are some interesting effects that are possible, though expertise is dwindling.

Tom

 107,995 pts.