Discussion:
Need some help with CPYTOPCD and SNDDST
(too old to reply)
Hal
2011-05-19 00:07:27 UTC
Permalink
Hi All...

I'm not a real good programmer so I'm gonna do my best to explain, and
hope someone more knowledgeable than myself knows how to fix this
problem. I wrote a *CMD, an SQL stored procedure, and a CL program to
allow a couple users to pull information out of a couple payroll files
and then receive an email with the results of the program in their
inbox.

The *CMD collects one parameter, an integer number.
The CL program declares the parm from the *CMD, and runs the stored
procedure.
The stored procedure empties out my target 'work' table, selects
various columns from a number of tables based on the integer number
passed in, and strings all the columns together into one big column,
and writes the result set to the previously emptied table.

I then use CPYTOPCD to copy the LIBRARY/FILE(MEMBER) that the stored
procedure just updated to a folder/document combo in QDLS.

Finally, I use SNDDST to email out the file.

The users get the email, and its 99% perfect...but the problem is this
pesky EOF character that CPYTOPCD sticks on the end of the file.

I tried playing with the TRNFMT parameter, changing it to *NOTEXT.
This had the unwanted side effect of removing the carriage return/
linefeed from each row of data in the table, -and- the EOF character
from the file placed in QDLS.

I need one of two things to happen...I need to suppress the EOF
character and leave *TEXT in place for the TRNFMT parameter, or I need
to specify *NOTEXT and somehow add the CR/LF combo myself to the end
of each record, and I assume I would want to do this inside the stored
procedure so the necessary information is in the database table at the
time I execute the CPYTOPCD.

Any experts have a suggestion/pointer for me? I've searched a few
forums/sites and I found a few suggestions regarding adding a X'0D' to
the records in the table, but so far I can't figure out how to do
that?

Thanks,
John Yeung
2011-05-19 03:44:16 UTC
Permalink
Does it have to be a QDLS "PC document"? Have you looked into
CPYTOIMPF and CPYTOSTMF?

John
Hal
2011-05-22 18:24:44 UTC
Permalink
Does it have to be a QDLS "PC document"?  Have you looked into
CPYTOIMPF and CPYTOSTMF?
John
Well, I think it does...if you want to use SNDDST to send the email. I
was not able to find a way to send a stream file from the IFS as an
attachment via SNDDST....?

Chris
CRPence
2011-05-22 18:54:25 UTC
Permalink
Post by Hal
Post by John Yeung
Does it have to be a QDLS "PC document"? Have you looked into
CPYTOIMPF and CPYTOSTMF?
Well, I think it does...if you want to use SNDDST to send the email.
I was not able to find a way to send a stream file from the IFS as
an attachment via SNDDST....?
While CPYTOPCD is limited to only being able to copy into the /QDLS,
that does not preclude other copy features from being able to copy into
the /QDLS. I am not aware of all of the limitations or restrictions of
CPY [aka COPY], CPYTOIMPF, and CPYTOSTMF with regard to their target
file system, but the /QDLS is support for a "stream file" system with
fairly severe restrictions on file naming [i.e. IIRC referred to as the
eight point three or 8.3 naming], so surely one or more must support
copying data into the /QDLS.? In a test of using each to copy program
described [flat] file.mbr data into /QDLS I received an error about not
being enrolled rather than an error that /QDLS was unsupported... so I
infer any may be able to effect the copy into /QDLS; I even seem to
recall actual cases of CPYTOIMPF being used with a TOSTMF('/QDLS/...')
while providing some support for that feature.

Regards, Chuck
highvalue.fr
2011-05-23 06:26:42 UTC
Permalink
Post by Hal
Does it have to be a QDLS "PC document"? Have you looked into
CPYTOIMPF and CPYTOSTMF?
John
Well, I think it does...if you want to use SNDDST to send the email. I
was not able to find a way to send a stream file from the IFS as an
attachment via SNDDST....?
Chris
Hi,

1) you can create stream file in the IFS with CPYTOIMPF and use MOV command
to put the result file in QDLS directory before SNDST.

or

2) I don't have the link in the hand, but you can use free MMAIL utility to
send mail and attachements without SNDDST

Best regards,

FF

Emile
2011-05-19 20:01:17 UTC
Permalink
Take a look at the CPYTOIMPF command. Its doesn´t set the EOF char.

You can still use a folder to output from this command by using
/qdls/foldername/documentname (using 8.3 for folder and documentname)

With wrklnk you can access the IFS and access the directories for example
WRKLNK OBJ('/qdls') lists all the folders

Emile
xyzzy
2011-05-20 20:36:01 UTC
Permalink
Post by Hal
The users get the email, and its 99% perfect...but the problem is this
pesky EOF character that CPYTOPCD sticks on the end of the file.
Why is the EOF character a problem?
Hal
2011-05-22 18:25:16 UTC
Permalink
Post by xyzzy
Post by Hal
The users get the email, and its 99% perfect...but the problem is this
pesky EOF character that CPYTOPCD sticks on the end of the file.
Why is the EOF character a problem?
Because of the system the file is being imported to....apparently
their code is rather strict and excess characters past the last record
cause them a problem...

Chris
Loading...