Copy Spooled File to a Source Physical File Member

15 pts.
Tags:
AS/400
COBOL
Copy File
i5
IBM iSeries
Physical File
Spool files
How do I copy a spooled file listing into a member of a source physical file?

I accidentally deleted the source member, but have a spooled copy taken via option 6.  I would like to convert the spooled file back into the deleted member.

Answer Wiki

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

Step 1 – CRTPF QTEMP/WFILE RCDLEN(133)
Step 2 – CPYSPLF QPSUPRTF QTEMP/WFILE (your job name/number)
Step 3 – Use WRYQRY to create a new PF. Define result fields to parse the input reecord into the 3 fields needed for a source PF. Also use Select to omit the records from page heading.
Step 4 – Use CPYF to copy this new file into your source file member. Use FMTOPT(*CVTSRC)

Discuss This Question: 6  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
    CRTPF QTEMP/WFILE RCDLEN(133) Although a length of 133 is reasonable, it implies two likely assumptions. First, it implies that the spooled file record length is 132. Second, it implies that the CPYSPLF command will specify the CTLCHAR(*FCFC) option. If either of those assumptions isn't true, then RCDLEN() might need to be a different value. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    After some thought, you consider this:
    • Create a SQL table, not in QTEMP:
      CREATE TABLE mylib.SRCSPLF ( 
      	SRCDATA CHAR(132) CCSID 37 NOT NULL )
    • Create a VIEW over the table:
      CREATE VIEW mylib.SRCSPLFV ( 
      	SRCDATA ) 
      	AS 
      	SELECT SUBSTR(SRCDATA, 9, 80) AS SRCDTA FROM mylib.SRCSPLF
    The table will be the target for CPYSPLF. Then the view is the source for CPYF. By sizing the SRCDATA column and the SUBSTR() appropriately, you get just the columns of the spooled file that have the source data. You might even have a WHERE clause on the view that drops the page headings from the source listing. The source member will need some editing to remove lines such as page headings. Tom
    125,585 pointsBadges:
    report
  • Splat
    Open a new member in your source file using SEU; F15=Browse/Copy options; Select 2=Spool file, and under the Browse/copy spool file section enter the spool file name, job, user, job number, and spool number; copy the spool file into the member and make any necessary adjustments to the alignment (LT and RT are your friends).
    7,545 pointsBadges:
    report
  • Splat
    Addendum: you will need to strip out the page headings, &c., but unless you're dealing with hundreds of pages it shouldn't be particularly onerous.
    7,545 pointsBadges:
    report
  • TomLiotta
    ...using SEU; F15=Browse/Copy options; Select 2=Spool file, and under the Browse/copy spool file section... This is probably the best choice for a one-time or infrequent recovery option. Good call. Tom
    125,585 pointsBadges:
    report
  • dinuas400
    Using the CPYSPLF u can achieve this requirement..
    510 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