can we use cl programming to update or delete physical files
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
A pgm subroutine calling child subroutine, that child subroutine again calling parent subroutine, u have 1000 lines of code, with out debugging , how can u find that error??? Is there any command to find errors in pgm???
which program rpg or cl is efficent to update a transaction onto a database file and why ?
What is the difference between inner join @ outer join
give an eg of ACQ-(ACQUIRE),BIT OFF,BIT ON,DEALLOC,DUMP,FEOD,FORCE,MHHZO,MHLZO,MHLLZO,MLHZO,REL,RESET,TESTZ,TESTB,TESTN----GIVE SMALL EXAMPLE TO THE OPCODES...TO UNDERSTAND FUNCTIONING...........
1. What is bound-by-call and bound-by-reference? 2. Where and why is *Nomain used? 3. What are the difficulties faced by programmers when using service programs? 4. Explain the different ways of parsing and compiling XML in iSeries.
In how many ways a session/device error occurs,,, and what is the remedy for it?
how to find whether a date format is valid or not in RPG400 not in RPGILE.Can you please write the coding for this sir,i'm new to AS400.Please help.
Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student in rpg
what is the necessary command needed before OPNQRYF and why?
what is program status data structure?
I have a Physical File name 'File1', which is present in two libraries named 'LIB1' & 'LIB2'. These 2 libraries are listed in the library list. Would like to access data from this file from these two libraries using RPG program. How to do this, any idea?
wat is the difference between dataarea and data queue?
5 Answers Airtel, Four soft, Shahi Exports,