Requirement is copy a VB file (ims segment unload file).
All the fields are getting copied including comp-3 if values are present, if values are not present production file is having empty or Null (neither space nor zeros). But copied file is having either space or zeros, i want like production file. Below is the sort card. Please let me know your inputs.
Part of the Sort Card:
if values are not present production file is having empty or Null (neither space nor zeros).
in IT using the right terminology is essential for effective communcation.
EMPTYness NULLness is the absence of a value ...
the only way to determine it is ...
use an indicator as db2 does to tell that the <field> is missing
or valid generally only for the last fields of a record
by checking the record length
for example for a vb record which usually is 100 bytes
reading/observing a record of 95 bytes tells that something is missing
since IT is deterministic it is safe to assume that the last field is empty/NULL
rephrase Your requirement so that we do not have to decode the sort cards
I'm going to take an educated guess that you want to create output records with some fixed fields and then follow that with the variable fields starting at position 151. If so, you can use DFSORT statements like this (note that position without length of 151 at the end tells DFSORT to copy the input bytes from position 151 to the end of the record as indicated by the RDW length):
If that doesn't give you what you want, then you'll need to do a better job of explaining what it is you want to do exactly:
Show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file. If the file can have duplicates within it, show that in your example.
Requirement is to copy Production file in to Test region with modified layout.
If values are present in the Production file , fields are getting copied no issues.
If values are not present in the Production file , in Test file it is showing Spaces. In Production file it is empty (neither spaces nor zeros). My requirement is, sort out file should look like production file. like ACHGDETL(2) field should not have spaces in Test if values are not present it should be empty like production file. How to achieve this...? Share your thoughts.
I can able to copy other datasets from Production to Test and Modify.
Only this dataset is giving problem if fields are empty. If values are present it is getting copied. No issues.
How the dataset is created.. In Simple terms if data found in IMS segment(s), then computes the results and write the results into IMS segments.
If no data found then it is not writing into IMS segments.
This production file is unload of IMS segment(s) from the job.
You're still not describing things clearly. Is the "Modified file with Hex On" the output you are getting or the output you want?
If your records are VB, then they an RDW in the first four bytes which gives the length of the record (binary value in first two bytes). This is how records of different lengths are handled for a VB file. The RDW is critical.
How are you examining the records to see what they look like? ISPF edit, for example, will show trailing blanks for VB records that aren't really there (as indicated by the RDW length).
You need to show an example of what the input records look like in hex with the RDW and a corresponding example of what the output records should look like in hex with the RDW.
You can do that kind of display with a DFSORT job like this:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... file to be displayed in hex
//SORTOUT DD SYSOUT=*
//SYSIN DD *
Your description of empty, missing, spaces, zeros, etc is quite confusing.
I suspect your real problem is that you have "short records", that is, records which do NOT contain all fields as indicated by the length in the RDW. How you would handle these short records, depends on what your input looks like exactly (including the RDW length) and what you expect for output.
You may, in fact, need IFTHEN clauses to test the RDW length to see which fields are present and which aren't and build the output records accordingly.
Since I still don't really know what you're trying to do, that's the best sample I can give you. A more specific sample would require a better understanding of what exactly you are trying to do, and what your input and output records look like.
Thank you for the inputs and suggestions. Finally found the actual problem. The first written JCL Sort card is working good. The Root cause is not with the JCL.
It is basically related to IMS segment length change. In one of copybook used in the program, Hard coded (old) segment length is moved. Because of that it was pointing to other location leading to Soc 7. .