1)how to do date validation in rpg?
2)how to delete dUPLICATE RECORDS?

Answers were Sorted based on User's Feedback



1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / anonymus

TO VALIDATE DATE IN RPG .GO FOR "TEST" OPCODE
TO DELETE DUPLICATE RECORDS IN RPG GO FOR READE &DELETE
OPCODES

Is This Answer Correct ?    13 Yes 6 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / madhusudhan

1. Date Validation you can do with TESTD

2. Duplicate Records. There are two ways to delete this
a. Through SQL, after selecting the RRN numbers, you can
use the delete statement in SQL to delete the unwanted
record based on the RRN
b. Through RPG, but if you use the SETLL and READE, all
the records along with the duplicates will get deleted , so
you need to use one variable for count, once it reaches 1 ,
stop doing the delete.

Is This Answer Correct ?    5 Yes 0 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / riyaz

Hi Sumathi, How can u delete duplicate records using RRN?

Is This Answer Correct ?    5 Yes 1 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / raghav

1. TESTD

2. Delete from File1 F1 where RRN(f1) > (select MIN(RRN(F2)) from File1 F2 where F2.Field1 = F1.Field1)

Is This Answer Correct ?    2 Yes 0 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / swetha p rao

TEST works in RPG400 not in RPG.

Is This Answer Correct ?    3 Yes 2 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / chandu

We can delete duplicate records by using this:
factor1 opcode factor2 result eq
key setll pf
reade pf 50
dow *in50=*off
delete rec1
reade pf 50
enddo

Is This Answer Correct ?    4 Yes 4 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / vivek kumar dwivedi

FPF#4 UF E K DISK
C 'ABC ' SETLLR1 44 25
C *IN55 DOWEQ*OFF
C READER1 55
C *IN55 IFEQ *ON
C LEAVE
C ENDIF
C DELETR1
C ENDDO
C SETON LR

Is This Answer Correct ?    0 Yes 0 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / sekhar

For Date validation we can use TESTD Opcode
Duplicate records can be deleted using RRN

Is This Answer Correct ?    3 Yes 4 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / zhang

Hi Riyaz, Sorry I'm not Sumathi,
I guess maybe we can use SQL to do that.
Select RRN(tableA) from tableA ;
Delete from tableA where RRN(tableA) =? ;

Is This Answer Correct ?    4 Yes 6 No

1)how to do date validation in rpg? 2)how to delete dUPLICATE RECORDS?..

Answer / sekhar

1: FOR DATE VALIDATION

/FREE
TESTD(E) *ISO(WHAT EVER) DATE VARIABLE ;
IF %ERROR ;
DO SOME THING ;
ENDIF ;
/END-FREE
2: CREATE A LOGICAL ON THAT FILE WITH KEY SAY FILE1
IN RPG

FFILE1 IP E K DISK
D X S 9S 0
D
I RECORDFORMAT-FILE1
I KEYFIELD L1 (CONTROL INDICATOR)

/FREE
X += 1 ;
IF X <> 1 ;
DELETE RECORDFORMAT ;
ENDIF ;

/END-FREE
CL1 RESET X

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More RPG400 Interview Questions

i)What is the command to lock a file in a program ii)2. Can you get a level check error in a CL program

6 Answers  


I have one cl program which calls two rpg programs named a & b. I am loading a run time array in Pgm A and the control comes back to cl pgm. i call pgmb and I want to read the runtime array in pgmb which was loaded in pgma. How it can be acheived. I should not use any intermediate file or dataarea to store the loaded values.

2 Answers  


What are the necessary keywords required to code a message subfile?

3 Answers  


we hav job which is running as batch. it takes atleast 06hours to complete tht job. bu i wana do tht job with in 3hours.........? so plz post ur answers

8 Answers   Cap Gemini, IBM,


how can i retrieve the field name from display file at run time? Devendra Singh Tomar

3 Answers  






1.WHAT IS WRONG WITH THE CODE BELOW? C CUSTNO CHAIN CUSTMAST IF %ERROR can any body find the wrong please? 2.What builtin function will you use to achieve the following functionality? C QTY IFLT *ZERO C QTY MULT-1 QTY ENDIF

5 Answers   CTS,


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

0 Answers  


what is file identifier wher we can use

1 Answers   IBM,


how does the rpg element work?

0 Answers   IBM,


Can we used ovrdbf command after the opnqry file if yes then What will be out put of your program?

4 Answers   IBM,


steps involved in debugging and types of debugging modes?

1 Answers  


1.I have a Batch job, Running for 4 hours, i want to reduce the executing time to 2 hours what should you do?

5 Answers   Cap Gemini,


Categories