Create a file on magnetic tape

From Rosetta Code
Create a file on magnetic tape is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

In this task, the job is to create a new file called "TAPE.FILE" of any size on Magnetic Tape

JCL

<lang JCL>// EXEC PGM=IEBGENER //* Create a file named "TAPE.FILE" on magnetic tape; "UNIT=TAPE" //* may vary depending on site-specific esoteric name assignment //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT2 DD UNIT=TAPE,DSN=TAPE.FILE,DISP=(,CATLG) //SYSUT1 DD * DATA TO BE WRITTEN TO TAPE /* </lang>

TUSCRIPT

<lang tuscript> $$ MODE TUSCRIPT STATUS = CREATE ("tape.file",tape-o,-std-) PRINT STATUS </lang> Output:

OK

UNIX Shell

<lang sh>#!/bin/sh cd # Make our home directory current echo "Hello World!" > hello.jnk # Create a junk file

  1. tape rewind # Uncomment this to rewind the tape

tar c hello.jnk # Traditonal archivers use magnetic tape by default

  1. tar c hello.jnk > /dev/tape # With newer archivers redirection is needed

</lang>

ZX Spectrum Basic

The ZX Spectrum does not have file type extensions, so we save as TAPEFILE, rather than TAPE.FILE. We can use any start address, depending on where we want the data to come from. Here we dump the contents of the screen:

<lang zxbasic>SAVE "TAPEFILE" CODE 16384,6912</lang>