Brian Hill | 1 Aug 18:42 2008
Picon

STRPCO and STRPCCMD on Linux client

Hello everyone,

I've been unable to get the STRPCO/STRPCCMD command to work with tn5250.

in my .tn5250rc file I have HILLB1 defined like this:

HILLB1{
host = xx.xx.xx.xx
env.DEVNAME=HILLB1
+local_print_key
+uninhibited
+allow_strpccmd
}

I normally use xt5250 so I issue the following command:  xt5250 HILLB1
which starts a session with the AS/400.  I log in and then issue the
command STRPCO.  Then, to make sure that it worked I issue the STRPCO
command again and I get a message that says:  "iSeries Access Organizer
is already active for device HILLB1."  So I know that STRPCO is working.

I then issue the command STRPCCMD and hit F4 to prompt.  I enter
"/usr/bin/kate" (without the quotes), leave the Pause parameter set to
*YES (the default) and hit enter.  I then get a message that says,
"Required PC program (PCO.EXE) is not active.  No communications with PC
can occur.  Press ENTER to resume."

So I thought to myself, "Self, maybe it only works with tn5250 and not
xt5250."  So I followed the same steps as above but I started with: 
tn5250 HILLB1

(Continue reading)

Scott Klement | 1 Aug 19:13 2008

Re: STRPCO and STRPCCMD on Linux client

Hi Brian,

Please search your source code to see if you have the strpccmd support 
in the source code. To find out, do the following:

1) Switch to the directory containing the lib5250 sources (your path 
name might be different)

     cd /whatever/tn5250/lib5250

2) See if there's a function called 'display_check_pccmd' in display.c 
by typing:

    grep display_check_pccmd display.c

3) See if there's a function called tn5250_run_cmd in utility.c by typing:

    grep tn5250_run_cmd utility.c

If either step 2 or step 3 comes up empty, it means that you don't have 
the code for strpccmd.  If that's the case, check out the latest copy of 
the source from CVS.   If you do have them, and you're still getting 
this error, then for some reason it's not recognizing that you have/want 
to use strpccmd...  which would be very strange, and require additional 
poking/prodding to find out what's going on.

Brian Hill wrote:
> Hello everyone,
> 
> I've been unable to get the STRPCO/STRPCCMD command to work with tn5250.
(Continue reading)

Brian Hill | 1 Aug 19:48 2008
Picon

Re: STRPCO and STRPCCMD on Linux client

Aha!  That's it Scott, the 0.17.3 release does NOT have either of those
functions you point out below.

I'll check out the source from CVS this weekend and experiment with it
and I'm sure it'll work fine then.

Thanks!

Scott Klement wrote:
> Hi Brian,
>
> 2) See if there's a function called 'display_check_pccmd' in display.c 
> by typing:
>
>     grep display_check_pccmd display.c
>
> 3) See if there's a function called tn5250_run_cmd in utility.c by typing:
>
>     grep tn5250_run_cmd utility.c
>   
--

-- 
This is the Linux 5250 Development Project (LINUX5250) mailing list
To post a message email: LINUX5250@...
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/linux5250
or email: LINUX5250-request@...
Before posting, please take a moment to review the archives
at http://archive.midrange.com/linux5250.

(Continue reading)

Mitch Martin | 8 Aug 16:41 2008

Script file to customize scs2ascii output - Assistance needed.


Hello all,

I've been using tn5250 on a Linux server for over a year and sending i5
print sessions to Windows network printers while converting the output
to ascii, pdf and even tiff.  It's the greatest thing since sliced
bread!!  ;-)

I now have a need for something a little different and I'm asking for
any hints on the best way to accomplish it. (Not being a bash scripting
guru, myself)

I want to take the output of scs2ascii and search that output for a
user's name.  Each output is a document containing 1 of 5 possible user
names.  I then want to write that output as a file using the user name
as the filename and maybe adding the current date and time.  I may want
to further process or format that output but I can probably manage that
with enscript as I've been doing.

My thoughts are to setup variables with the 5 user names and then use
grep to test for each user, check the return status code for a match and
then write the filename.  That is overly simplified, of course.  I'm
currently reading a shell programming book and hoping to put a script
together but would appreciate any guidance from the more experienced
programmers on this list.

Thanks for any help.

Regards,
Mitch
(Continue reading)

Scott Klement | 8 Aug 18:02 2008

Re: Script file to customize scs2ascii output - Assistance needed.

Is there any sort of a 'label' on the printout?  I guess I'm hoping that 
the printout will have something like this:

'UserID: xxxxxxxxxx'

Then you can use grep to look for the 'UserID:' string, and use cut or 
awk whatever tool is appropriate to extract the actual userid. This 
seems like a better idea than running grep multiple times -- especially 
if the number of users increases.

...other than that, I'm not sure what sort of guidance you're looking 
for?  It sounds like a very simple script to me.

Mitch Martin wrote:
> Hello all,
> 
> I've been using tn5250 on a Linux server for over a year and sending i5
> print sessions to Windows network printers while converting the output
> to ascii, pdf and even tiff.  It's the greatest thing since sliced
> bread!!  ;-)
> 
> I now have a need for something a little different and I'm asking for
> any hints on the best way to accomplish it. (Not being a bash scripting
> guru, myself)
> 
> I want to take the output of scs2ascii and search that output for a
> user's name.  Each output is a document containing 1 of 5 possible user
> names.  I then want to write that output as a file using the user name
> as the filename and maybe adding the current date and time.  I may want
> to further process or format that output but I can probably manage that
(Continue reading)

tstanfill | 8 Aug 18:08 2008

Re: Script file to customize scs2ascii output - Assistance needed.

Something like this should work...

users="user1 user2 user3 user4 user5"
file=<name of file>

for user in $users; do
  grep $user $file >/dev/null &&  cat $file > /tmp/"$user"_`date
+%Y-%m-%d-%H:%m` && break
done

--- - Toby Stanfill
--- - Sr. Programmer/Analyst
--- - O'Reilly Auto Parts
--- - (417)862-2674 ext. 1291

This message is protected by the Electronic Communications Privacy Act, 18
USCS § 2510 et seq., and may not be used, copied or forwarded without the
consent of the named recipient(s).  The information contained in this
message is confidential, is intended only for the use of the individual or
entity named.  If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited.  If you have received this
communication in error, please notify me immediately at 417-862-2674 ext
1291.

                                                                           
             "Mitch Martin"                                                
             <mmartin <at> monroenc                                             
             .org>                                                      To 
             Sent by:                  <LINUX5250@...>            
(Continue reading)

Mitch Martin | 8 Aug 19:23 2008

Re: Script file to customize scs2ascii output -Assistance needed.

> 
> Something like this should work...
> 
> users="user1 user2 user3 user4 user5"
> file=<name of file>
> 
> for user in $users; do
>   grep $user $file >/dev/null &&  cat $file > /tmp/"$user"_`date
> +%Y-%m-%d-%H:%m` && break
> done
> 

Okay... It will take me a little while to figure that out but I look
forward to doing so.

Thanks for the suggestion, Toby!

Regards,
Mitch

> --- - Toby Stanfill
> --- - Sr. Programmer/Analyst
> --- - O'Reilly Auto Parts
> --- - (417)862-2674 ext. 1291
> 

--

-- 
This is the Linux 5250 Development Project (LINUX5250) mailing list
To post a message email: LINUX5250@...
To subscribe, unsubscribe, or change list options,
(Continue reading)

Mitch Martin | 8 Aug 19:21 2008

Re: Script file to customize scs2ascii output - Assistance needed.

> Is there any sort of a 'label' on the printout?  I guess I'm 
> hoping that the printout will have something like this:
> 
> 'UserID: xxxxxxxxxx'
> 

Yes, on the second line, middle of the page, the label is INSPECTOR:
The user name varies in length like so:
	INSPECTOR: JOE INSPECTOR
	INSPECTOR: JOE E. INSPECTOR

> Then you can use grep to look for the 'UserID:' string, and 
> use cut or awk whatever tool is appropriate to extract the 
> actual userid. This seems like a better idea than running 
> grep multiple times -- especially if the number of users increases.
> 

Thanks for that suggestion.  I don't expect the users to increase over
5.
At least not until I can increase my knowledge of scripting.

> ...other than that, I'm not sure what sort of guidance you're 
> looking for?  It sounds like a very simple script to me.
> 

Yes, I'm sure that it does sound that way to you!!  ;-)

Thanks Scott!
--

-- 
This is the Linux 5250 Development Project (LINUX5250) mailing list
(Continue reading)

Mitch Martin | 8 Aug 19:46 2008

Re: Script file to customize scs2ascii output -Assistance needed.


Toby,

That certainly worked for me.  Would you explain the reason for
>/dev/null and the break command?  In the mean time, I will research it
in my book.

Also, will this script work by piping the output of scs2ascii to my
script?  I haven't tried that yet.  Here is the script, so far:

#! /bin/bash

file=/home/misadmin/ID-4892.txt
users="PHILLIP SAM RICHARD"

for user in $users; do
grep $user $file >/dev/null &&  cat $file > /home/misadmin/"$user"_`date
+%Y-%m-%d-%H:%m` && break
done

>Something like this should work...
>
>users="user1 user2 user3 user4 user5"
>file=<name of file>
>
>for user in $users; do
>  grep $user $file >/dev/null &&  cat $file > /tmp/"$user"_`date
>+%Y-%m-%d-%H:%m` && break
>done
>
(Continue reading)

tstanfill | 8 Aug 20:13 2008

Re: Script file to customize scs2ascii output -Assistance needed.

>/dev/null is to keep grep quiet... otherwise it would output the line that
matched.  If you want to see it when a match is found, then you could take
that out.  The break is there so when it finds a match it breaks out of the
loop, since there's no reason to keep looping once a match is found.

If you want to pipe the output of scs2ascii through this script, you would
have to do it like so:

#! /bin/bash

file=`cat /dev/stdin`
users="PHILLIP SAM RICHARD"

for user in $users; do
echo "$file" | grep $user >/dev/null &&  echo "$file" >
/home/misadmin/"$user"_`date
+%Y-%m-%d-%H:%m` && break
done

--- - Toby Stanfill
--- - Sr. Programmer/Analyst
--- - O'Reilly Auto Parts
--- - (417)862-2674 ext. 1291

This message is protected by the Electronic Communications Privacy Act, 18
USCS § 2510 et seq., and may not be used, copied or forwarded without the
consent of the named recipient(s).  The information contained in this
message is confidential, is intended only for the use of the individual or
entity named.  If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, distribution or copying of
(Continue reading)


Gmane