20 pts.
 Special Files In RPG
Dear All,



In RPG we have the concept of "Special Files", where the I/O
operations of this file is handling by user written program. Could anyone
please brief me the significance of using special file and what is the
advantage of Special file over disk file? It would be great, if anyone could
explain some scenario to use special files.


Thanks &
Regards,


Bibin  



Software/Hardware used:
AS400
ASKED: Jan 20, 2012  6:36 AM GMT
UPDATED: February 28, 2012  11:21:55 AM GMT
66,990 pts.
  Help
 Approved Answer - Chosen by BibinG (Question Asker)

what is the advantage of Special file over disk file?

There is no advantage. Why would you think there would be an advantage? A 'special' file is little more than a way to use RPG to interface with some external programmed function. The 'special' file can provide a stable interface while the function behind it goes through significant change.

Nowadays with RPG IV, there are far better alternatives -- procedures, functions, service programs.with signatures, access to essentially all APIs. Essentially everything that could have been done in old RPG with 'special' files can be done better in RPG IV without needing them.

Tom
ANSWERED:  Jan 20, 2012  7:05 AM (GMT)  by TomLiotta   66,990 pts.

 
Other Answers:
The way this works is that you supply the name of the “I/O handler” program that handles the file operations in a keyword on the F spec (PGMNAME). A standard parameter list is sent to that program whenever any I/O operation is performed on the file.

The standard parameter list includes the action or operation that was requested (e.g., open, read, write, update, etc.), a character field representing the record data for the file, a status code that you can use to signal conditions (e.g., an error or end of file) and an error code so the I/O handler program can signal specific errors back to the “calling” program.

If the I/O handler program needs additional information not included in those standard parameters, additional parameters may be passed. These are specified with another F spec keyword (PLIST).
Last Wiki Answer Submitted:  Jan 20, 2012  9:14 AM (GMT)  by  Pdsathishkumar   3,665 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _




what is the advantage of Special file over disk file?

There is no advantage. Why would you think there would be an advantage? A ’special’ file is little more than a way to use RPG to interface with some external programmed function. The ’special’ file can provide a stable interface while the function behind it goes through significant change.

Nowadays with RPG IV, there are far better alternatives — procedures, functions, service programs.with signatures, access to essentially all APIs. Essentially everything that could have been done in old RPG with ’special’ files can be done better in RPG IV without needing them.

Tom

 66,990 pts.