RPGLE. cpytopcd

15 pts.
Tags:
CPYTOPCD
RPGLE
RPGLE Program
I have tried to create a file where every record is 80 characters long. Every record should be filled with spaces if the record is shorter than 80 char. In my program I use cpytopcd and this command seems to cut every record if there aren't any more characters. If you look at it in hexadec there are no values. I then tride to write a space (by using hexadec 20) in position 80. If I do this and look at it in hexadec the file contains 20 for every space except for the last one. Positon 80 contains C4. Does anyone have a clue why? What can I do to solve this?

Answer Wiki

Thanks. We'll let you know when a new response is added.

On the CPYTOPCD command use the option TRNFMT(*NOTEXT)

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    I have tried to create a file... How? That is, what operation are you using to 'create' a 'file'? What kind of file are you trying to create? Where are you trying to create it? Why are you using CPYTOPCD? (Perhaps because someone told you to?) What do you want to do with the file? How is it supposed to be accessed? A 'file' might be a database file, a 'flat' file, a stream file, or potentially any one of a variety of other kinds of files. The structures are different between them. CPYTOPCD is related to a few possible kinds of files. It can potentially create a kind of streamfile that is intended for mostly obsolete purposes. Tom
    125,585 pointsBadges:
    report
  • Kasten
    As you probably figured out I'm fairly new at this. I'm changing an existing program and it uses the cpytopcd command. The file I'm writing to, using Except, contains one field(80). The file is to be used in another pc-system. All I have is a file layout. They need every record to be 80 char with space filling and CRLF. The cpytopcd command looks like this: CPYOTOPCD FROMFILE (QQFILE) TOFLR('LE/INK') TODOC(FEKBSE.TST) REPLACE(*YES) TRNFMT(*TEXT)
    15 pointsBadges:
    report
  • TomLiotta
    Well, it seems like a strange request since PC applications normally wouldn't care about trailing spaces. However, if the file doesn't contain anything but text characters, I'd probably use TRNFMT(*NOTEXT). I know that sounds contradictory, but *NOTEXT should avoid trailing-blank truncation. I'm not clear on what the point of the character in position 80 is. I'd first suspect that it's a placeholder -- an attempt to retain spaces. I'd net think it was an identifying character that indicated what kind of record it was. With *NOTEXT, though, you'd possibly need a record length of 82 and you'd have to put the CRLF characters into positions 81-82 yourself before copying. What kind of data is going into the lines? Do you have a few sample lines from a valid version of the file you need to create? Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following