AS400 Mid Range/alpha to numeric
Expert: Concise Systems/Laird Scranton - 1/16/2008
QuestionQUESTION: does this look ok?
fdanserl if f 8 disk
fdanserlx o f 8 disk
idanserl ns 01
i 1 30nnn
i 4 8 alpha
c 01 move *zeros onex
c 01 move *blanks num
c 01 eval onex = nnn
c 01 eval num = %trimr(alpha)
c 01 move num numx
c 01 write danselrx
c n01 seton lr
odanserlx d 01
o onex 3
o numx z8
ANSWER: It looks generally OK to me. I'm not certain off the top of my head whether the EVAL NUM = %TRIMR(ALPHA) will produce a left-justified or right-justified result. But try it and see!
- Laird
---------- FOLLOW-UP ----------
QUESTION: i want to run a qry on a cl with record select, are you familiar with that? and how is it done
AnswerI normally avoid the use of QRY in my software, partly because it is a 'hog' when it comes to response time, and partly because I have better control over what happens if I design a work file, then write a program to select data and create the work file records.
I know you can use the OPNQRYF command with a Query-Select statement to do record selection. The details of how to do this with a prompt screen in a CL program are beyond what is really practical to instruct by e-mail. You have to use variables from the prompt screen with the *CAT functions to create the Query-Select statement.
Or you can create a Query definition, then call it from a CL program using the RUNQRY command.
- Laird