28. Accessing files on PC and local area network

 

To access files on PC and on local area network (LAN): A prerequsite is that IBM ISPF program "Workstation Agent" is installed and is running on the PC which is to be used.

28.a Installation of "Workstation Agent"

The program "Workstation Agent" is part of ISPF. Check menu 3.7.1 for information regarding installation.

Alternative:

Activate wsa whenever the PC is started up if you want to access PC files via RXS.

28.b Accessing the PC from RXS

pc

General order pc must indicate the name of the actually used PC (The name of a PC is the name used for remote connection to the PC. Alternatively, the internet URL addressing the PC may be used).

If in or out holds a name containing one or several '\' it is considered the complete name (inclusive path) of a file on the indicated PC or on a local area network accessible by that PC.

Different action blocks in the RXS program may read or write different PC's.

As default characters are converted from ASCII to EBCDIC when reading from the PC - and the opposite when writing to the PC. 'Newline' characters ('0D'x + '0A'x) on the PC will break the mainframe file into records - and opposite around.

Constraint: Records having length zero are written to the PC as a line containing one blank.

28.c func='binary': Reading from the PC without character conversion

func='binary' implies that actual bits are transmitted 'as is' that is witout ASCII/EBCDIC conversion. 'Newline' characters ('0D'x + '0A'x) are also transmitted as it. Accordingly, input to RXS from the PC will consist of just one record (but notice that a record internally in RXS may consist of 16 MB of data).

28.d outfunc='binary': Writing to the PC without character conversion

outfunc='binary' implies that actual bits are transmitted 'as is' that is without ASCII/EBCDIC conversion

 

 

Example 28.1

)action out='c:\clutter\myfile.txt'

)&      pc='r2d2-2'

"What's up doc?"

)endaction

The line: "What's up doc?", is written as the content of the indicated file on the indicated directory (C:) on the indicated PC. Character representation will be ASCII.

Adding:

)&      outfunc='binary'

as general order  will transmit file as is, accordingly the PC will receive the file as EBCDIC.

 

Example 28.2

)action in='c:\clutter\myfile.txt'

)&      pc='r2d2-2'

unit.1

)endaction

According to example 28.1 the string "What's up doc?" is written on mainframe standard output, <user>.rxs.data. Character representation will be EBCDIC.

Adding:

)&      func='binary'

as general order  will transmit file as is, accordingly RXS on mainframe will receive the file as ASCII.

 

 

Example 28.3

)action in='o:\ourdept\ouroffice\ourfile.htm'

)&      pc='r2d2-2'

myvar = unit.1

)action out='c:\diverse\ourfile.htm'

)&      pc='r2d2-2'

  myvar

)endaction

)action out='c:\diverse\ourfile.htm'

)&      pc='yrsa-1'

myvar

)endaction

)endaction

The example copies one file from the local area network over to two different PC's. The users of the two PC's will be prompted for whether they will accept the connection.

 

Example 28.4

Reading a spreadsheet :

)action in='C:\diverse\this_sheet.txt'

)&      pc='R2D2-2' 

)&      strt=1

)&      n.=''

)&      v.=''

  if strt = 1 then do

    stmt1 = "parse var unit.1 n.1"

    do ix = 2 to 255

      stmt1 = stmt1 "'05'x  n."ix

    end

    interpret stmt1

    stmt2 = "parse var unit.1 v.1"

    do ix = 2 to 255

      stmt2 = stmt2 "'05'x  v."ix

    end

    do ix = 1 to 255

      if n.ii = '' then leave

      change(' ', '_',n.ii)

    end

  end

  else do

    interpret stmt2

    do ii = 1 to 255

      if n.ii = '' then leave

      n.ii'('v.ii')'

    end

    ";"

  end

  strt = 0

)endaction

A spreadsheet is saved as a tabulator-separated .txt file on the PC. The RXS program transforms the spreadsheet to a mainframe file which is using the RXS namespace form. It is assumed that the columns of the spreadsheet are named in the first row. These names are used as names in the created namespace file. The namespace file is presented on screen at termination. To make sense, the example should use the namespace file to something - say putting the values into some DB2-table with fitting names.

If the spreadsheet contains

 

A

B

C

1

Department

Name

Monthly Salary

2

SALES

Jens Olsen

30000

3

SALES

Peter Poulsen

42500

4

INFORMATION

Ole Jensen

45500

then the created file RXS.DATA will contain

Department(SALES) Name(Jens Olsen) Monthly_Salary(30000)

;

Department(SALES) Name(Peter Poulsen) Monthly_Salary(42500)

;

Department(INFORMATION) Name(Ole Jensen) Monthly_Salary(45500)

;