Hi,
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:
OPTION COPY
OUTREC IFTHEN=(WHEN=(63,8,CH,EQ,C'condition'),
BUILD=(1:1,4,5:5,141,146:C'AR8',149:C'AAA',152:C'P',153:C'W',
154:SEQNUM,5,ZD,159:8C' ',167:151,1,
168:152,7,PD,TO=PD,LENGTH=7,
175:159,7,PD,TO=PD,LENGTH=7,
182:166,2,
184:168,4,
188:172,8,
196:180,1,ZD,TO=ZD,LENGTH=1,
197:181,2,
199:183,1,
200:184,7,PD,TO=PD,LENGTH=7, 207:191,7,PD,TO=PD,LENGTH=7))
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
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Sriramhari,
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.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
It is far more useful to use the Code tags than the font colours. The colours get in the way and waste time.
If you have a dataset in Production which you'd like to emulate in Test, you should just be able to do it the same way as Production does without having to mess it about with anything.
Now, as you have yet to mention how this dataset is created in Production, then I'd suspect we'd not have a clue.
ok..
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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:
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... file to be displayed in hex
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,4,1,4,HEX,X,5,HEX)
/*
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. .