Natural and Printing part II

Greetings from California! I also need help printing from Natural in Linux.
I am currently in the process of migrating several applications and Adabas files from Natural 3.16/Adabas 7.13 IBM VSE to Suse Linux Enterprise 9.1, with Natural 6.11/Adabas 3.3.2.02. I need to find a way of printing from several departments to several different printers. We have jobs that submit rje from batch and online in addition to batch jcl on the mainframe. We use a term-id based db on the mainframe to setup the list cards to point to correct printer and that works great, on the mainframe. Now to get something similar in Suse Linux. Currently we have 4 printers defined and I can print to them from direct commands at the command line but still cannot print from inside a natural program. I can create a file but I still cannot get the file to print. Our natparm is set as follows: (systems is the name of the printer)
Device Parameter Assignments ────────────────────────┐
│ Logical Line Page Max
│ Device Size Size Page Physical Device / Print to File? (Y/N)
│ -------- ---- ---- ----- -------------------------------------------------
│ VIDEO 80 24 32767 VIDEO N
│ LPT1 80 66 32767 $HOME/DefinePrinter.cat | lp -d systems Y
│ LPT2 80 66 32767 $HOME/DefinePrinter.cat Y
│ LPT3 80 66 32767 $HOME/Test.rpt Y

The program I am using to try and print is real simple:

define data local
1 test (a10)
end-define
test := ‘test print’
define printer(LPT1 = 1) OUTPUT ‘LPT1’
WRITE (1) TEST ‘SYSTEMS IS PRINTER LPT1 TEST FOR SJLH’
END

The file DefinePrinter.cat is created and looks like:

Page 1 05-10-17 16:17:31

test print SYSTEMS IS PRINTER LPT1 TEST FOR SJLH

But it doesn’t print… I have a file, but I need it to print without having to give another command, Shouldnt the natparm setting for LPT1 with | lp -d systems cause it to print from that file??? I have tried all kinds of commands, nothing seems to work. So I am asking for some help in this regard. Thanks in advance.
John

Hello sjlh!

If you set “Print to File” in your parameter-module to “Yes” you are not able to execute linux commands. Natural only writes its output to the file named there. In your case, a file with the name “$HOME/DefinePrinter.cat | lp -d systems” should be created.

A way to solve your problem is to create an executalbe script (e.g. /sag/bin/LPT1) with the following content:

#!/bin/sh
cat > $HOME/DefinePrinter.cat           # creates a printfile
lp -d systems $HOME/DefinePrinter.cat   # prints out the printfile

You can do even more stuff in that script like making a backupcopy of the old printfile, appending a timestamp to the printfile’s name or writing a mail to somebody.
In the parameter-modul you have to set “Print to File” to “No” and enter the script’s name.
Example:

Logical  Line Page Max                                                    
Device   Size Size Page  Physical Device / Print to File? (Y/N)           
-------- ---- ---- ----- -------------------------------------------------
VIDEO      80   24 32767 VIDEO                                           N
LPT1       80   66 32767 /sag/bin/LPT1                                   N
LPT2       80   66 32767 /sag/bin/LPT2                                   N

Thanks Matthias!! Ok, We have created 4 entries in natparm, LPT1, LPT2, LPT3, LPT4. They now look like:
LPT1 80 66 32767 /usr/sag/Scripts/LPT1 N
LPT2 80 66 32767 /usr/sag/Scripts/LPT2 N
LPT3 80 66 32767 /usr/sag/Scripts/LPT3 N
LPT4 80 66 32767 /usr/sag/Scripts/LPT4 N

Our scripts look like:

cat > $HOME/PrintJobs/LPT4.rpt
lp -d systems $HOME/PrintJobs/LPT4.rpt
exit 0

Only difference being 1 or 2 or 3 or 4 in LPT…
Funny thing happens when I run my program:

define data local
1 test (a10)
1 x1 (n6)
end-define
define printer(LPT3 = 3) OUTPUT ‘LPT3’
for x1 1 to 50
WRITE (3) x1 ‘SYSTEMS IS PRINTER LPT3 TEST FOR SJLH’
end-for
END

This does work, but if I change to 1 or 2 or 3, ie (LPT1, LPT2 or LPT3)
I get a Callstack trace handler at PC (nil),
and a NAT1586 (Unable to submit print job)
Is this a core dump?
I can execute my scrpts and they will work outside of Natural, but not from inside, only LPT3 works, not 1,2 or 4.
Is there another setting somewhere that I need to change? Seems odd it works for one but not for all.
Thanks again!!

You’re right. That’s odd!
Please try the following on the Linux command line to see if all rights are set correctly:

ls -l /usr/sag/Scripts/LPT*

Hi,

This may be the well-known problem that printing interferes with signal handling.

Please try to set the environment variable SMP_STACKSIGNAL to 0 (export SMP_STACKSIGNAL=0) and see if it helps.

Ahhh success, the permissions were set correctly,
-rwxr-xr-x 1 sag sag 92 2005-10-20 11:05 LPT1
-rwxr-xr-x 1 sag sag 92 2005-10-20 11:05 LPT2
-rwxr-xr-x 1 sag sag 92 2005-10-20 11:01 LPT3
-rwxr-xr-x 1 sag sag 89 2005-10-21 11:33 LPT4
but my natparms somehow lost the settings, except for LPT3, dont know how that happened, And the StackSetting did the trick for correcting the dump and 1586 error. We can print to any printer THANKS !!!
Now is there a way to pass the login for every user to Natural Security in order to set the environment settings, like which printer, or separate Natparm, ie: How can we direct the login for every user(1000+) and cause the default printer (possibly other settings) to be set at login time??
Hoping someone has done this before on a large scale. Still not sure how to setup logins for 1000’s of users either, all of us are setup to login as sag, but I am sure the other users wont use sag, maybe need to start another subject. Anyways, Thanks much.
SJLH

Hmmm. I think you have to tell more about your configuration. Sorry, I’ve never used Natural Security. But if you got 1000 Linux-Users, I can give you some tips:
Linux knows two profiles. One of it (/etc/profile) is a global profile, executed by EVERY user at login-time. The other one is a personal profile which is located in the HOME-directory of the user ($HOME/.profile). In both profiles you can set some environment variables. Example:

# .profile of user xy
export NATLPT03 = /sag/bin/LPT3

Then you have to change your Natparm device-settings to:

Logical  Line Page Max                                                    
Device   Size Size Page  Physical Device / Print to File? (Y/N)           
-------- ---- ---- ----- -------------------------------------------------
VIDEO      80   24 32767 VIDEO                                           N
LPT1       80   66 32767 /sag/bin/LPT1                                   N
LPT2       80   66 32767 /sag/bin/LPT2                                   N
LPT3       80   66 32767 $NATLPT03                                       N

Ok, here is a little sketch of our configuration: We are the IS dept responsible for storing and processing and routing data for all of the county departments. We currently have SAG products Natural, Natural Security, Adabas, Predict, PAC, Entire Network, Natural Connection running on IBM mainframe architecture, utilizing a LAN/WAN system which stretches over several hundred miles thru fiber and wire connections. We have several dozen Departments connected to the IBM and several Windows servers, and a couple Linux machines from a large geographical area, with over a 1000 users logged in at any given time. So we have a large task at hand in progress moving the Natural/Adabas (etc) functions to the Linux environment, and so setting up the printing part will probably be a big part of this effort. Currently we have only one login setup, SAG, I know we will need more obviously, but still not sure how we’re going to set that part up. We were thinking that as a user logs in, it will run a script that will set the envireonment, ie: printer assigns etc, but also we only want the users to login once, so that will require us to do some scripting and passing info to Natural Security?? to accomplish our goal. Just not sure how to do it. I was hoping someone has a similar setup. Thanks in advance, your help has made my job a little less stressfull.
John

Basically, it is possible to set some Linux environment-varibles and pass them through to Natural (e.g. workfile or printfile-names). Or maybe you can use $USER or $LOGNAME for an automatic login to Natural Security. But that’s anyone’s guess.
I hope there is forum-user who uses Natural Security on Linux…

Greetings ! I need help printing from Natural in Windows.

I’m getting a nat1583 error.
I’m printing to a file from Natural one .

Already put the define printer command and defined LPT1 in the Natural Configuration file.

Thanks.