Skip to content

FF API: File Functions

Date Revised: 9/12/23 

FF: File Function

This API has several options that help perform operations for file names; in particular, on long file names (length greater than 100 characters and/or containing one of more embedded SPACEs). 

Notes:

  1. This API generally uses Screen-Area instead of Screen-Alpha-Field in order to accommodate filenames up to 160 characters.
  2. Some or these APIs require multiple calls to achieve the desired result.
The function performed depends on the value passed in Screen-Row:  

  • FF,01 Check if directory exists

.              In:     Screen-Area: Long pathname ending in "\", or Long filename whose directory 

                       is to be checked

.              Out:  Screen-Answer: "Y" if path exists; "N" if not

.                      Screen-Numeric-Field: Size of file if file exists, otherwise 0

 

  • FF,02 Check if file exists

.              In:     Screen-Area: Long filename

.              Out:  Screen-Answer: "Y" if file exists; "N" if not

 

  • FF,03 Copy file

           FF,03,01

              In:      Screen-Area: Source long filename

           FF,03,02 and FF,03,02,01 - Replace file if it already exists

              In:      Screen-Area: Target long filename

              Out:   "Y" if successful; "N" if not

            FF,03,02,02 - Do not replace file if it already exists

              In:     Screen-Area: Target long filename

              Out:   "Y" if successful; "N" if not

            FF,03,02,03 - Copy file and if it already exists append date and time onto file name (filenameYYYYMMDDHHMMSS.ext)

              In:     Screen-Area: Target long filename

              Out:   Screen-Answer: "Y" if successful; "N" if not

                        Screen-Area: This will contain the new name of the file


  • FF,04 Delete file

              In:      Screen-Area: Long filename

              Out:   Screen-Answer: "Y" if file deleted; "N" if not

 

  • FF,05 Rename file

           FF,05,01

              In:      Screen-Area: Source long filename

           FF,05,02

              In:      Screen-Area: Target long filename

              Out:   "Y" if successfully renamed; "N" if not

 

  • FF,06 Return next file in filespec

           FF,06,01

              In:      Screen-Area: Source long filespec (with wildcards)

              Out:   Screen-Area: Full filename (w/ path) of first file

                       Screen-Answer = "N" means no more qualifying files

            FF,06

              Out:   Screen-Area: Full filename (w/ path) of next file

                       Screen-Answer = "N" means no more qualifying files

 

  • FF,07 Split a filename into components

           FF,07,01

              In:      Screen-Area: Source long filename

              Out:   Screen-Area: Path portion of filename

           FF,07,02

              In:      Screen-Area: Source long filename

              Out:   Screen-Area: base portion of filename

           FF,07,03

              In:      Screen-Area: Source long filename

              Out:   Screen-Area: filename extent (without ".")

 

  • FF,08 Join a filename from components

           FF,08,01

              In:      Screen-Area: Path portion of target filename

           FF,08,02

              In:      Screen-Area: Base portion of target filename

           FF,08,03

              In:      Screen-Area: File extent of target filename

              Out:   Screen-Area: Joined full filename

 

  • FF,09 Get short filename

.              In:      Screen-Area: Long filename

.              Out:   Screen-Area: Short filename


  • FF,10 Move file

           FF,10,01

              In:     Screen-Area: Source long filename

           FF,10,02 - Move file and if it already exists append date and time onto file name (filenameYYYYMMDDHHMMSS.ext)

              In:     Screen-Area: Target long filename

              Out:  Screen-Answer: "Y" if successful; "N" if not

                        Screen-Area: This will contain the new name of the file

 JEG/CLS

NWSMSCRN.CBL

Feedback and Knowledge Base