This is my Physical file 'EMPS' existing in library "TAMIL1"
and its record format is 'EMPRCD"
a)its source is

R EMPRCD
ENO 4 0
ENAME 10
EADD 10

b)The records present in EMPS are as follows

ENO ENAME EADD

0001 tamil coimbatore
0002 kumar bangalore
0003 sunder bangalore
0004 arunkumar chennai
0005 pandi hyderabad
0006 santhosh hyderabad
0007 sasi salem
0008 kalai chennai
0009 suresh hyderabad
0010 vijay bangalore
0011 Arul chennai
0012 velu chennai
0013 khan bangalore
0014 praba chennai
0015 praba.p coimbatore
0016 anand ooty
0017 raja erode
0018 sankar erode
0019 vadivel namakkal
0020 anbu chennai
0021 Ajith mumabi

c)now i want to select the 'ENAME' field records starting
with 'S'
for that i have created a RPG program
its source code is

PGM
DCLF FILE(TAMIL1/EMPS)
DCL VAR(&MYENO) TYPE(*CHAR) LEN(4)
OVRDBF FILE(EMPS) SHARE(*YES)
OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ
%WLDCRD("S *")')
READ: RCVF RCDFMT(EMPRCD)
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
CHGVAR VAR(&MYENO) VALUE(&ENO)
SNDUSRMSG MSG(&MYENO)
SNDUSRMSG MSG(&ENAME)
SNDUSRMSG MSG(&EADD)
GOTO READ
END: CLOF OPNID(EMPS)
DLTOVR FILE(EMPS)
ENDPGM

Is this coding correct sir,the program gets compiled,and if
i call it it says query running but records are not
displayed.please help me out

Answer Posted / katiyar

Looks like your answer is correct, Just little modification
as per my understanding and as per your requirement.
--------------------------------------------------------
PGM
DCLF FILE(TAMIL1/EMPS)
OVRDBF FILE(TAMIL1/EMPS) SHAR(*YES)
OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ + %WLDCRD
("S*")')

/*--To See the result in file, Use following commands--*/

CPYFRMQRYF FROMOPNID(TAMIL1/EMPS) TOFILE(TAMIL1/TESTPF1) +
MBROPT(*REPLACE) CRTFILE(*YES)

RUNQRY QRYFILE((TAMIL1/TESTPF1))


READ: RCVF RCDFMT(EMPRCD)
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))

/*---To See the result, Use following commands----*/

SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&ENAME) +
TOPGMQ(*EXT)
SNDUSRMSG MSG(&ENAME) TOUSR(&USERNAME)

****Provide your User Profile Name in TOUSR = &USERNAME
/*-------------------------------------------------*/
SNDUSRMSG MSG(&ENAME)
GOTO READ
END: CLOF OPNID(EMPS)
DLTOVR FILE(EMPS)
ENDPGM

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
I am sure, this will help you.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to write record if no field or the field are different in physical file in rpgle ?

498


Explain mdt?

672


can anybody help me to solve this problem. the program that i m checking display error message saying "Record format for file AJDSPFFD does not match model file and decimal error. how to solve this problem. The AJDSPFFD is snapshot the AJTLOG that is the audit trail list.

2287


How can we know running job is batch or interactive?

666


how do I play {insert rpg system here}?

595






What are the types of identifiers?

579


what was the robotech rpg?

691


What is the difference between iter and do?

685


How Chain operation copies the record's data to the input buffer for the program?

1094


during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.

762


what is the use of sflnxtchg?

820


what is *place and *auto keyword in prtf ?plz explain

2738


what is an online rpg?

741


how do I declare a minor?

724


can any one help in hawkeye and turnover or any change management system plzzzzz or send the documents to my mail id :gvsp.as4@gmail.com

1979