INPUT_DD: the data definition (DD) file to be
copied. The default value is DD INFILE.
URI: the destination Cloud Storage
uniform resource identifier (URI) of the file to be copied.
ENCODING: the input character encoding. The
default value is CP037.
Restore a file from Cloud Storage to your mainframe
You can use the gsutil cp command to restore a file from
Cloud Storage to a mainframe dataset. Note that you cannot copy
partitioned data sets (PDS).
To restore a file from Cloud Storage to a mainframe dataset, use the
following steps:
Specify the DSN and space requirements of the file you want to download to
your mainframe in JCL. In the following example, the record format (RECFM) in
the output file is FB. Modify the OUTFILE DD to fit your
requirements.
Run the gsutil cp command in the following format. If the file
already exists on your Mainframe, make sure that you add the
--replace flag to the command.
GCS_URI: the Cloud Storage URI of the
Cloud Storage file. For example, gs://bucket/sample.mainframe.dsn.
DSN: the DSN destination location on the mainframe.
RECFM: the record format (RECFM) of the mainframe file. The
valid values are F, FB, and U. Note that these values are case-insensitive.
LRECL: (optional) the record length (LRECL) of the
file. The value must be an integer >= 0. If LRECL is not
specified the file is assumed to be in the undefined-length record format
(U).
BLKSIZE: (Optional) The block-size of the file. If set to 0, the
system will determine the optimal block-size. The value must be an integer
>= 0. If you don't specify a value, the file is treated as an unblocked
file.
noseek: (Optional) Include this parameter if you want to improve
download performance. This flag is set to false by default, that is, seek
operations are enabled.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[],[],null,["# Archive mainframe data to Cloud Storage\n\nThis page describes how you can archive and restore your mainframe data to\nCloud Storage by using Mainframe Connector.\n\nBefore you begin\n----------------\n\n- [Get started with Mainframe Connector](/mainframe-connector/docs/get-started)\n- [Install Mainframe Connector on your mainframe](/mainframe-connector/docs/install-mainframe-connector)\n\nArchive mainframe files to Cloud Storage\n----------------------------------------\n\nTo archive files from your mainframe to Cloud Storage, follow these\nsteps:\n\n1. [Create a storage bucket](/storage/docs/creating-buckets) for your archives.\n When creating the bucket, make sure to choose the **Archive** storage class.\n\n2. You can archive your mainframe binary data as is to a Cloud Storage\n bucket. To do this, use the [`scp` command](/mainframe-connector/docs/api-command-reference#scp)\n as follows:\n\n ```\n scp --inDD=INPUT_DD\n --gcsOutUri=URI\n --encoding=ENCODING\n –-noConvert\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eINPUT_DD:\u003c/var\u003e the data definition (DD) file to be copied. The default value is [DD INFILE](/mainframe-connector/docs/reference#dataset-names).\n - \u003cvar translate=\"no\"\u003eURI:\u003c/var\u003e the destination Cloud Storage uniform resource identifier (URI) of the file to be copied.\n - \u003cvar translate=\"no\"\u003eENCODING:\u003c/var\u003e the input character encoding. The default value is CP037.\n\n | **Note:** Optionally, you can convert your mainframe binary data to an ORC, CSV, or JSON file to a Cloud Storage bucket using the [`qsam decode` command](/mainframe-connector/docs/api-command-reference#qsam_decode).\n\nRestore a file from Cloud Storage to your mainframe\n---------------------------------------------------\n\nYou can use the `gsutil cp` command to restore a file from\nCloud Storage to a mainframe dataset. Note that you cannot copy\npartitioned data sets (PDS).\n| **Note:** You can only restore mainframe binary data that you archived as is (without converting to any other file format) using the `gsutil cp` command. Mainframe Connector doesn't support restoring mainframe data that is converted to other file formats.\n\nTo restore a file from Cloud Storage to a mainframe dataset, use the\nfollowing steps:\n\n1. Specify the DSN and space requirements of the file you want to download to\n your mainframe in JCL. In the following example, the record format (RECFM) in\n the output file is `FB`. Modify the OUTFILE DD to fit your\n requirements.\n\n //OUTFILE DD DSN=MAINFRAME.DSN.FILE,DISP=(,CATLG),\n // RECFM=FB,DSORG=PS,\n // SPACE=(10,(2,1),RLSE),\n // AVGREC=M,\n // UNIT=SYSDA\n //SYSPRINT DD SYSOUT=*\n //SYSDUMP DD SYSOUT=*\n //STDIN DD *\n\n2. Run the `gsutil cp` command in the following format. If the file\n already exists on your Mainframe, make sure that you add the\n \u003cvar translate=\"no\"\u003e--replace\u003c/var\u003e flag to the command.\n\n ```\n gsutil cp GCS_URI DSN --recfm=RECFM --lrecl=LRECL --blksize=BLKSIZE --noseek\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eGCS_URI\u003c/var\u003e: the Cloud Storage URI of the Cloud Storage file. For example, `gs://bucket/sample.mainframe.dsn`.\n - \u003cvar translate=\"no\"\u003eDSN\u003c/var\u003e: the DSN destination location on the mainframe.\n - \u003cvar translate=\"no\"\u003eRECFM\u003c/var\u003e: the record format (RECFM) of the mainframe file. The valid values are F, FB, and U. Note that these values are case-insensitive.\n - \u003cvar translate=\"no\"\u003eLRECL\u003c/var\u003e: (optional) the record length (`LRECL`) of the file. The value must be an integer \\\u003e= 0. If `LRECL` is not specified the file is assumed to be in the undefined-length record format (U).\n - \u003cvar translate=\"no\"\u003eBLKSIZE\u003c/var\u003e: (Optional) The block-size of the file. If set to 0, the system will determine the optimal block-size. The value must be an integer \\\u003e= 0. If you don't specify a value, the file is treated as an unblocked file.\n - \u003cvar translate=\"no\"\u003enoseek\u003c/var\u003e: (Optional) Include this parameter if you want to improve download performance. This flag is set to false by default, that is, seek operations are enabled."]]