+ switch (cmd.mode)
+ {
+ case FH_CHARACTER:
+ properties.mode = FH_MODE_TEXT;
+ if (cmd.sbc_tabwidth)
+ properties.tab_width = cmd.n_tabwidth[0];
+ break;
+ case FH_IMAGE:
+ properties.mode = FH_MODE_FIXED;
+ break;
+ case FH_BINARY:
+ properties.mode = FH_MODE_VARIABLE;
+ break;
+ case FH_360:
+ properties.encoding = "EBCDIC-US";
+ if (cmd.recform == FH_FIXED || cmd.recform == FH_F)
+ properties.mode = FH_MODE_FIXED;
+ else if (cmd.recform == FH_VARIABLE || cmd.recform == FH_V)
+ {
+ properties.mode = FH_MODE_360_VARIABLE;
+ properties.record_width = 8192;
+ }
+ else if (cmd.recform == FH_SPANNED || cmd.recform == FH_VS)
+ {
+ properties.mode = FH_MODE_360_SPANNED;
+ properties.record_width = 8192;
+ }
+ else
+ {
+ msg (SE, _("RECFORM must be specified with MODE=360."));
+ goto lossage;
+ }
+ break;
+ default:
+ NOT_REACHED ();
+ }
+
+ if (properties.mode == FH_MODE_FIXED || cmd.n_lrecl[0] != LONG_MIN)
+ {
+ if (cmd.n_lrecl[0] == LONG_MIN)
+ msg (SE, _("The specified file mode requires LRECL. "
+ "Assuming %zu-character records."),
+ properties.record_width);
+ else if (cmd.n_lrecl[0] < 1 || cmd.n_lrecl[0] >= (1UL << 31))
+ msg (SE, _("Record length (%ld) must be between 1 and %lu bytes. "
+ "Assuming %d-character records."),
+ cmd.n_lrecl[0], (1UL << 31) - 1, properties.record_width);
+ else
+ properties.record_width = cmd.n_lrecl[0];
+ }
+
+ fh_create_file (handle_name, cmd.s_name, &properties);
+ }