z/OS Extensions
The z/OS extensions for Vim enable direct editing of MVS datasets with integration of z/OS–specific features. These extensions support dataset integrity, platform resource controls, and automatic syntax handling to provide a native editing experience on z/OS.
- Direct editing of MVS datasets and members.
- Enforcement of dataset attributes such as LRECL.
- z/OS ENQ/DEQ resource serialisation.
- Automatic syntax highlighting based on dataset naming conventions.
Opening and Editing Datasets
You can open and edit an MVS dataset member directly from Vim by using the following command:
vim "//'DATASET.NAME(MEMBER)'"
This command opens the specified dataset member in the current Vim window.
Supported Operations
-
:e,:split,:vsplit: Opens dataset members in the current window, horizontal split, or vertical split. Allows working with multiple datasets simultaneously in different windows. -
Vim diff: Compares two dataset members side-by-side using
vimdiffor:diffsplit. Highlights differences between versions, useful for code review and change tracking. -
Read-only support: Automatically detects and displays
[readonly]in the status line for datasets with read-only permissions. Prevents accidental modifications to protected datasets likeSYS1.PARMLIBorSYS1.PROCLIB. -
Syntax highlighting: Automatically applies syntax highlighting by mapping dataset names to Unix file extensions. For example, a dataset matching
*.COBOLis treated as a.cobfile, enabling COBOL syntax highlighting. -
LRECL enforcement: Enforces the dataset's logical record length (LRECL) for fixed block (FB) datasets. Prevents adding characters beyond the record length boundary, maintaining dataset integrity.
-
Margin reference: Displays a visual margin indicator at the LRECL boundary. Helps users stay within the fixed record length and avoid accidental overflow, particularly useful for JCL and COBOL editing.
-
ENQ/DEQ support: Respects z/OS resource serialization. Vim checks for ENQ (enqueue) locks before writing to datasets, preventing concurrent modification conflicts and ensuring data integrity.
Examples
" Edit dataset
vim "//'PROD.JCL(MYJOB)'"
" Compare datasets
vimdiff "//'PROD.COBOL(PROG)'" "//'TEST.COBOL(PROG)'"
" View read-only system dataset
vim "//'SYS1.PROCLIB(JES2)'"
Configuration
- Path specified by the $DIO_CONFIG environment variable
- $HOME/.dioconfig.json in the user’s home directory
- Default configuration provided with the build
Example Configuration
{
"*.COBOL": {
"extension": "cob",
"type": "text",
"codepage": "IBM-037"
},
"*.JCL": {
"extension": "jcl",
"type": "text",
"codepage": "IBM-1047"
},
"*.REXX": {
"extension": "rexx",
"type": "text",
"codepage": "IBM-1047"
},
"*.ASM": {
"extension": "asm",
"type": "text",
"codepage": "IBM-037"
},
"*.DATA": {
"extension": "txt",
"type": "text",
"codepage": "IBM-1047"
},
"*.TEMPLATE": {
"extension": "tmpl",
"type": "text",
"codepage": "IBM-1047"
}
}
Configuration Fields
| Field | Description |
|---|---|
|
Pattern |
Wildcard pattern (for example, *.COBOL) used to match dataset names. |
|
extension |
Unix file extension mapped to the dataset; determines Vim syntax highlighting. |
|
type |
Specifies how Vim should handle the dataset content. Dataset content type: text or binary. |
|
codepage |
Character encoding used for EBCDIC–ASCII conversion (for example, IBM-1047, IBM-037) |
Default Configuration
If no user-specific configuration is found, Vim uses the default configuration provided with the build.You can override default behaviour by creating your own configuration file.
Limitations
- Cannot allocate new datasets
- Cannot browse PDSE like directories
- Auto-complete does not work on datasets
- Must respect dataset LRECL for fixed block formats