Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

COBOL Module 9

EBCDIC, record layouts, Unicode and JSON interview questions

Interview questions on EBCDIC, record layouts, Unicode and JSON: warm-ups, then what each harder question tests and how a good answer starts.

15 questions: 4 warm-ups and 11 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    Why does the same text have different bytes on z/OS and on a laptop?

    Answered in the lesson EBCDIC, code pages and collating order

  2. Fresher to mid

    How do you work out a record's length and each field's offset from a copybook?

    Answered in the lesson Copybook layouts and converting mainframe extracts

  3. Fresher to mid

    Why can a PIC X(30) field not hold a 30-character name in Devanagari?

    Answered in the lesson UTF-8, national data and names in Indian scripts

  4. Fresher to mid

    What do the NAME and SUPPRESS phrases of JSON GENERATE do?

    Answered in the lesson JSON and XML: GENERATE and PARSE

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Mid to senior

    A nightly job copies a file of customer codes, sorted on z/OS, to a Linux server, where a GnuCOBOL program checks that the codes ascend. It stops at the first code that starts with a digit. The file is not damaged. What is happening, and what are your options?

    What it tests
    Knowing the EBCDIC and ASCII collating orders, seeing that a file's order belongs to the system that sorted it, and choosing between sorting again and comparing in EBCDIC order.
    First step
    Look at the two codes on either side of the error. A code that starts with a letter followed by one that starts with a digit is in order in EBCDIC, where letters come before digits, and out of order in ASCII, where digits come first: the lesson's A001 and 1001 compared both ways.
    Follow-ups

    From the lesson EBCDIC, code pages and collating order

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  2. Fresher to mid

    After a new transfer job moved an account extract from z/OS to a server, the account numbers and names look right, but many balances are wrong and some negative amounts arrived positive. Nothing failed. What do you suspect, and how do you fix and prove it?

    What it tests
    Telling text from packed, binary and zoned fields, knowing what a text-mode transfer does to each, and proving a conversion with totals.
    First step
    Compare the bytes of one record on both sides with a hex dump. If the text fields match after translation but a packed balance such as X'01234C' arrived as X'01833C', as in the lesson, the transfer translated every byte as a character.
    Follow-ups

    From the lesson EBCDIC, code pages and collating order

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  3. Mid to senior

    A converter on a Linux server reads a z/OS extract with the right copybook, yet every field after the fourth comes out as garbage while the first four are right. The copybook has two PIC S9(2) COMP fields. What do you check, and how do you fix it for good?

    What it tests
    Computing offsets, knowing that binary sizes depend on the compiler's dialect, and adding a length check that fails on the first record.
    First step
    Print the offset and length of each field as the converter's compiler lays them out, and compare with the sizes z/OS uses: in the lesson, GnuCOBOL's default dialect gave PIC S9(2) COMP 1 byte where z/OS gives 2, which moved every later field by one byte.
    Follow-ups

    From the lesson Copybook layouts and converting mainframe extracts

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Mid to senior

    A new COBOL converter writes every negative zoned amount of an EBCDIC extract as a positive number, while the packed balances and all text fields are right. What could cause it, and how do you find the step that loses the sign?

    What it tests
    Knowing where a zoned field keeps its sign, how translation and sign conventions interact, and finding a defect by looking at the bytes after each step.
    First step
    Take one negative amount and print its bytes in hexadecimal after each step of the converter. The zone of the last byte, D on z/OS, carries the sign, so look for the first step after which that byte, or the character that stands for it, no longer means negative.
    Follow-ups

    From the lesson Copybook layouts and converting mainframe extracts

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  5. Senior to staff

    You must prove that a converted extract of two million account records matches the data on z/OS before it is loaded into a new system. What evidence do you produce, and what does each piece prove?

    What it tests
    Designing a reconciliation from independent checks on both sides, handling rejects, and knowing what each check cannot catch.
    First step
    List what can go wrong, records lost or added, fields decoded wrongly, signs flipped, then choose for each a check computed independently on both sides, starting with the trailer's record count and balance total.
    Follow-ups

    From the lesson Copybook layouts and converting mainframe extracts

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  6. Mid to senior

    Customer names in Hindi and Tamil arrive from a web form in UTF-8. After a nightly COBOL job copies them into PIC X(40) fields, the next system rejects some records for invalid characters. What happened, and how do you fix and prove it?

    What it tests
    Knowing that MOVE cuts bytes, that a split character makes a field invalid UTF-8, and cutting and checking fields on character boundaries.
    First step
    Take a rejected record and look at the last bytes of its name field in hexadecimal. A field that ends with a byte that starts a character, such as E0, without the bytes that complete it, was cut in the middle of a character by a MOVE into a field that was too short.
    Follow-ups

    From the lesson UTF-8, national data and names in Indian scripts

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Fresher to mid

    A new interface must carry customer names of up to 40 characters in any Indian script, or in Latin letters. How many bytes do you give the field in a GnuCOBOL program that keeps UTF-8 in PIC X, and what else goes into the interface description?

    What it tests
    Sizing a UTF-8 field from the bytes a character can take, and stating the encoding and the limits at a boundary.
    First step
    Work out how many UTF-8 bytes one character of each script can take, then settle whether the limit of 40 counts what a reader sees or Unicode code points, because a vowel sign or a virama is a code point of its own.
    Follow-ups

    From the lesson UTF-8, national data and names in Indian scripts

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  8. Senior to staff

    A bank plans to store names in Indian scripts in a z/OS COBOL application whose unit tests run with GnuCOBOL on developers' computers. Would you use national data, UTF-8 items or PIC X fields, and why?

    What it tests
    Comparing the Unicode support of Enterprise COBOL 6.5 and GnuCOBOL 3.2, and keeping one source that both compilers build and test.
    First step
    List what each compiler supports: Enterprise COBOL 6.5 has national data in UTF-16 and UTF-8 items with PICTURE U, while GnuCOBOL 3.2's NEWS lists only parsing support for USAGE UTF-8. Then list what the tests must exercise on the developers' computers.
    Follow-ups

    From the lesson UTF-8, national data and names in Indian scripts

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  9. Mid to senior

    A batch program that reads partner records as JSON was moved to GnuCOBOL 3.2 for testing. It runs to the end with return code 0, yet every record it writes is empty. What do you check first, and how do you make sure it cannot happen again?

    What it tests
    Knowing that a compiler may accept a statement it does not implement, reading its warnings, and making the build and the tests fail on them.
    First step
    Read the compiler's warnings for the program, not only its exit status, then print JSON-CODE and one parsed field right after the first JSON PARSE, so you see whether the statement did anything at all.
    Follow-ups

    From the lesson JSON and XML: GENERATE and PARSE

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  10. Fresher to mid

    A service rejects some JSON documents that a COBOL program sends: the ones whose customer names contain quotes. The program builds each document with STRING. What is wrong, what is the risk beyond rejected messages, and how do you fix it?

    What it tests
    Knowing why values in a document must be escaped, the risk of building documents by joining strings, and generating documents instead.
    First step
    Parse one rejected document with a JSON validator and look at the character where the parser stops, next to the customer name it came from.
    Follow-ups

    From the lesson JSON and XML: GENERATE and PARSE

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  11. Mid to senior

    A program's JSON GENERATE fails on a few records every night with JSON-CODE 1, although the team doubled the receiver last month. How do you size the receiver properly, and what must the program do when generation fails?

    What it tests
    Working out the largest document a record can produce, knowing what a failed statement leaves behind, and handling the failure.
    First step
    Work out the longest document the record can produce, with every field at its full length and every name and punctuation character counted, and compare it with the receiver's size.
    Follow-ups

    From the lesson JSON and XML: GENERATE and PARSE

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes

All COBOL interview questions · The COBOL track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.