[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[],[],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."]]