can we use cl programming to update or delete physical files

Answers were Sorted based on User's Feedback



can we use cl programming to update or delete physical files..

Answer / anish

Although there are no keywords to update or insert or
delete records in a CL program, we can do the same with the
help of a 'RUNSQLSTM' statement. With this command we can
runa query directly from the CL program and do an
insert/update/delete without calling an RPG program.

Plzz let me know if my understanding is corerct.

Is This Answer Correct ?    32 Yes 4 No

can we use cl programming to update or delete physical files..

Answer / saravan

We can clear file using CLRPFM command.
If we want delete PF we can use DLTF command.
But before delete any PF first of all we need to
delete all the LFs related in that PF.(DSPDBR=Display Data
Base Relations,we can get all LFs relating to that PF)You
must give the correct Library name for all the commands
above.
For UPDATE, DELETE & INSERT, use RUNSQL command.
Ex: RUNSQL (UPDATE LIBR/FILE SET FLD = 'XXX'
WHERE CONDITION)
Note: RMVM is to delete/remove a member from a file. But
not to delet a file completely.

Is This Answer Correct ?    18 Yes 2 No

can we use cl programming to update or delete physical files..

Answer / narender

No, you can access the records using the CL program but
can't perform any operation other then reading the records.

Is This Answer Correct ?    19 Yes 10 No

can we use cl programming to update or delete physical files..

Answer / chirag

Hi,

First you need to create a TXT source in which you need to
provie the update command.
Next in CL program you should use the command RUNSQLSTM on
this source(TXT).
So whenever you have to change another record you need to
simply change and save the TXT source.

Examply:

Data on file, PF1:
FLD1 FLD2 FLD3
000001 001 AAA BBB
000002 002 BBB CCC
000003 003 CCC DDD
000004 004 XXX ZZZ


Member1, Name: PGM1 , Type: TXT
UPDATE PF1 SET FLD3 = 'CHG' WHERE FLD1 = '004';


Member2, Name: PGM2 , Type: TXT
PGM
RUNSQLSTM SRCFILE(LIB1/SRCFILE) SRCMBR(PGM1) +
COMMIT(*NONE)
ENDPGM

Compile the PGM2 and call it.

Now Result for data on PF1
FLD1 FLD2 FLD3
000001 001 AAA BBB
000002 002 BBB CCC
000003 003 CCC DDD
000004 004 XXX CHG

Is This Answer Correct ?    9 Yes 3 No

can we use cl programming to update or delete physical files..

Answer / nirosh

We can clear all records from the physical file using
CLRPFM command. If we want delete PF we can use DLTF
command.But before delete any PF first of all we need to
delete all the LFs related in that PF.(DSPDBR=Display Data
Base Relations,we can get all LFs relating to that PF)You
must give the correct Library name for all the commands
above. I don't know how to update PF from the CL
programming.

Is This Answer Correct ?    7 Yes 2 No

can we use cl programming to update or delete physical files..

Answer / sree

ok friends what is use of "RUNSQLSTM"

Is This Answer Correct ?    6 Yes 1 No

can we use cl programming to update or delete physical files..

Answer / lama

We can not perform update operation by using CL

Is This Answer Correct ?    12 Yes 9 No

can we use cl programming to update or delete physical files..

Answer / kamal

YES BY USING RUNSQLSTM

Is This Answer Correct ?    5 Yes 2 No

can we use cl programming to update or delete physical files..

Answer / ismail

Yes, With the help of 'RUNSQLSTM' command, we can able to
update/insert/delete record in PF.

Is This Answer Correct ?    2 Yes 1 No

can we use cl programming to update or delete physical files..

Answer / dinesh

we can not update pf
using cl because there is no such
keward

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More RPG400 Interview Questions

in rpg could u please tell me errors types and meanings like 3030 that ....

1 Answers   EXL, UHG,


i hav 2 logical files(L1,L2) both r derived from one physical file(P1). how can i use both the logical files in one RPG program? if yes what i have to d.

5 Answers   TCS,


Setps to create .csv file on IFS folder in AS/400( V4R3)....?

3 Answers   TCS,


When a object will be locked & when a record will be locked? Plz explain.

2 Answers  


Hi, Can anybody give me real sinario for SFLRCDNBR?with example?

2 Answers  






WHERE DO WE USE COMIT KEYWORD IN AN RPG PROGRAM? YOU MADE SOME CHANGES TO DATABASE BUT YOU DON'T WANT TO SAVE THOSE CHANGES NOW? HOW DO YOU HANDLE THIS ONE?

2 Answers  


suppose we have 10 members in physical file and i have to use 4 out of 10 so how can we read this in RPG

3 Answers   TCS,


How to sort an array in descending in RPG

3 Answers   Google, TCS,


If there are 1000 member(PGM type) in a SRC file. How can we compile in a CL program? ( It need to be done in a loop)?

1 Answers  


Job is in MSGW while reading the input file and writing a new record / updating a reacod due to Duplicate data error. What action would you take ( C D I R )...?

4 Answers  


How can you delete records form a file in rpg without using "Delete" OPCODE?

7 Answers  


Can any one plz explain the concept of INFSR, *PSSR, INFDS AND PSDS, I' confusing about PSDS and *PSSR, Wat is the difference btw them, wat PSDS will do????

1 Answers  


Categories