Mainframe Path Start learning free
Core9 min readLesson 6 of 6

From library stages to Git: source management and code pages

Library managers such as Endevor and ChangeMan ZMF move source through stages like development, test, QA and production, with packages and approvals. Git expresses the same ideas with branches, pull requests, protection rules and tags, usually with a pipeline promoting one build through the environments. Source is kept in Git as UTF-8 and converted to EBCDIC on z/OS through .gitattributes.

How library managers organise change

Described at the level of their public documentation: in Endevor, a life cycle is made of environments, for example DEV, TEST and PROD, each with a Stage 1 and a Stage 2, and an environment map that says where an element moves next. In ChangeMan ZMF, a change is a package: components are checked out from baseline libraries into the package's staging libraries, built, audited, frozen, promoted through test levels, approved, installed, and then become the new baseline, with backout to restore the previous version.

The same ideas in Git

Library manager ideaIn a Git workflow
Element or component in a libraryA file in the repository
Package of related changesA branch and its pull request
Approval before promotionRequired reviews on a protected branch, plus change records
Freeze: install what was testedA tag or commit id that the pipeline builds once and deploys
Promotion DEV → TEST → QA → PRODA pipeline deploying the same build to each environment, or merges into environment branches
Baseline / production librariesThe release branch and its tags
BackoutRedeploy the previous tag, or a revert commit

Two ways to model the stages

EBCDIC, code pages and .gitattributes

z/OS data sets and many z/OS UNIX files are in EBCDIC, while Git and almost every desktop tool expect UTF-8. The usual rule is: store UTF-8 in the repository, convert on z/OS. Git's working-tree-encoding attribute does the conversion: when such a file is added, Git re-encodes it to UTF-8 for the repository, and re-encodes it back on checkout. Git on z/OS adds a platform-scoped form, zos-working-tree-encoding, that applies only on z/OS, so the same repository checks out as IBM-1047 on z/OS and stays UTF-8 on laptops.

.gitattributes for a mainframe repository (fictional)Illustrative example
# text, converted to EBCDIC IBM-1047 only when checked out on z/OS
*.cbl  text zos-working-tree-encoding=ibm-1047
*.cpy  text zos-working-tree-encoding=ibm-1047
*.jcl  text zos-working-tree-encoding=ibm-1047
# never converted, never diffed or merged as text
*.bin  binary

Binary members and load modules

Load modules, object decks and other binaries are build outputs. Keep them out of the source repository (the pipeline rebuilds them and stores them as versioned artifacts) and, if a binary file must live in Git, mark it binary so nothing tries to convert or merge it.

TRY IT YOURSELF

Which .gitattributes attribute converts files to an EBCDIC code page only when they are checked out on z/OS?

Show a hint

The platform name in front of working-tree-encoding.

Show the solution

zos-working-tree-encoding, for example *.cbl text zos-working-tree-encoding=ibm-1047.

Examples are for learning. Run commands and jobs only on a system you are authorised to use, such as a training or test system, and never on production without approval.

Common mistakes

Committing EBCDIC bytes straight into the repository

Diffs, reviews and every desktop tool break. Store UTF-8 and convert on z/OS with .gitattributes.

Copying the library stages one-to-one into long-lived branches

Environment branches drift. Prefer one main line, tags, and a pipeline that promotes one build.

Leaving load modules in the source repository

They are build outputs: rebuild them in the pipeline and keep them as versioned artifacts, or mark them binary.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← Branch protection and change approvalBack to Git and GitHub for mainframe developers