How can I get the filename on PCC - Natural Unix

Hi,

I need to read a workfile. This workfile is on Windows environment. The program is Natural on Unix. I am using Entire Connection in order to get the data - as connection - emulation, however, Natural program needs to know the filename.
Does anyone know how can I get the filename?

Current Natural version: 6.1.1
Current Entire Connection version: 4.3.2

Thanks.[/b]

Hi.

Doesn’t entire connection pop up a selection box to choose the workfile at the READ statement of your Natural program (assuming that the workfile is set to type TRANSFER in NATPARM). Alternatively, you can preset the workfile in Entire Connection using the command prompt.

Peter

Hi Peter,

I already do it. After choosing the workfile in the popup, Natural program on Unix starts reading the data from the workfile. This program needs to read the workfile, check something on our database and print the information (report). On this report, I would like to print the filenanme as well, because I need to know where the data came from.
So, I would like to know how can I (Natural program) get the filename.
Sorry for any misunderstood.

Any idea?

Thanks.

Hi,

Is it possible to use APIs to solve this problem? If so, how can I call the APIs (PCC) from Unix (Natural program)?

Remember: Natural program on Unix needs to know the filename (workfile)

Does anyone have any other idea?

Thanks.

Have the user press a PF key to start the file transfer. On the PC, have the PF key defined to EXEC a procedure file (for example MyFileTrns.ncp). In the pc procedure file do your own prompt for the file name, then SET the file name so PCC knows it, then continue file transfer as usual. Then one of the following is possible…

Write the file’s name to a pre-determined pc file, then have your program also upload that pre-determined file.

Or have the procedure file append the file’s name to the end of the file being transferred before starting the upload. Since you are READing the work file, the last record read would be the filename you want.

Hi Darrell,

I didn’t understand how can I get the filename using API where you need to open your own prompt (if you have this API, please, attach on this issue). As far as I know, when I use Natural on Unix and Entire Connection, this prompt is opened automatically…If I force to open using API, the program won’t need to request the file again, is that it? But how Natural program (the variable) will know the filename?

Of course, another way to solve it, it is to include the filename in the workfile. At this moment, it is impossible to do it, because this file comes from other company and we will need to ask them to change the application. If there is no change to get the filename using API or userexit, than we will need to ask them to do it.

Thanks.

Hi,

I tried to use the API USR2011N with the options N and E, but it didn’t work. Maybe I need to use anything else.

Does anyone have any other idea?

Thanks.

Here is a quick example of one of my suggestions.

On the PC, define one of the available keys as EXEC samplup.ncp,
where samplup is the following sample procedure file to modify and upload a file.

To define an available key, use Configuration Manager → Terminal Objects → host sessions →
terminal emulation key scheme → add.

Save the following in the PC's Entire Connection folder PROC as samplup.ncp

INPUT #parm1 33 'Enter PCFILE name'
SET PCFILE 7 up data #parm1   /* Define work file 7; supresses prompt.

OPEN-O 1 #parm1   /* open the file. If existing we append.
 
if #RC EQ 'APPEND' write 1 #parm1 /* Exists; put the file name as last record

If #RC EQ 'SUCCESS'  WAIT 'File not fould, try again.' /* oops we just created it.

CLOSE 1

If #RC EQ 'SUCCESS' erase #parm1  /* file created new; erase it

schedule te  /* start or resume terminal emulation session

/* Here you would TYPE whatever command or key is necessary to launch the 
/* host's download. For example: TYPE PCUPLOAD or TYPE PF8

The host’s Natural program (PCUPLOAD in this example) would simply have:

READ WORK 7 #upload-data
AT END OF FILE
WRITE #upload-data /* show file name
. . .

So when the customer using Entire Connection hits the key defined as EXEC samplup.ncp the host program will print the file’s name.

Hi Darrell,

I did what you said and it WORKED. Thanks.

As the end-user wants perfect, he is asking me if it is possible to implement a feature where the user could choose the file in any directory on Windows. The example that you gave me, I think that is limited by 72 letters, besides that, I need to set the path before.

If you could provide me one more this facility, I would appreciate it a lot.

Thank you.

Hi,

Does anyone have any idea how to solve it?

Thanks

Hi all, Hi Darrell,

The end-user now is complaining about the length of the filename, since it is possible to type only 72 letters, included the directories.

The perfect solution would be a pop up in order to be possible to choose not only the location of the file, but the file that will be read as well.

I wonder if it would is possible to include a code to open this pop up in the same code above (since it is working so far)? Do you know how I can do it?

Thank you in advance.

Regards,

Billy