can any body correct the following code?
Following a procedure which returns the maximum of two
numbers.Correct the following code.

P GETMAX B
D GETMAX PI
D NUM1 35 0
D NUM2 45 0
C IF NUM1 > NUM2
C RETURN NUM1
C ELSE
C RETURN NUM2
C ENDIF
P GETMAX E

Answer Posted / vijay

to send a return value, you have to defined the return variable in front of PI which actually contain the return value the code should be as follows

P GETMAX B
D GETMAX PI 45 0
D NUM1 35 0
D NUM2 45 0
D rtnfld 45 0
C IF NUM1 > NUM2
C Eval rtnfld = Num1
C ELSE
C Eval rtnfld = Num2
C ENDIF
C Return rntfld
P GETMAX E

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between copybooks and subprocedures in as400?

812


Explain mdt?

667


Assume 2 users are using the same file and first user updates some record in the file. Will the 2nd user will be able to see the updated record or not?

517


what are the key words you must use when using a subfile?

694


Q:Hi all,i want accurate answer with code using in built functions.please sent me code as soon as posible. I have program nmed PGM1 which '' RETRIEVE Current production date''should correctly default the production date for the user who is issuing raw materials to the manufacturing.The production date can be different from the celendra date. However, the program does not make the correct adjustment for all manufacturing plants. there is a parameter which determines the production start time e.g. 07:00 if the system time precedes this,the program subtracts one from the celendra day.This work fine when the celendar day starts after production day as it does in England,the system should be adding one to the celendar day during the overlap. unfortunately the program was desined to assumed the celendar day always starts before the production day. Change required in the program: Change the PROGRAM PGM1 to use the new parrameter to decide whether to add or subtract 1 from the celendar day when determining the production date.

1764






do you use message subfiles? What are the necessary keywords required coding a message subfile?

690


what happens when sflsiz = sflpag? What are the advantages and disadvantages?

713


what is a rpg?

703


What is the difference between iter and do?

677


When it is desirable to describe files Internally?

1190


what was the robotech rpg?

686


How can we know running job is batch or interactive?

659


what is file information data structure?

1376


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

1971


can you debug ile rpg program using isdb?

739