IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VB file Outrec Build- Comp-3 fields


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Fri Mar 16, 2012 10:32 am
Reply with quote

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))

Thank You.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 16, 2012 12:00 pm
Reply with quote

Quote:
if values are not present production file is having empty or Null (neither space nor zeros).
icon_eek.gif

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
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Mar 16, 2012 11:01 pm
Reply with quote

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):

Code:

  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)


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.
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Mon Mar 19, 2012 1:51 pm
Reply with quote

Thank you All for replies. 'll improve my communication.

Production file with Hex on,COMMAND ===> SCROL
DSORG PS RECFM VB LRECL 1370 Rec# 101 - CAPS ON RDW OFF
FILLER(1,2) NCHGDETL(2) ACHGDETL(2) ACHGDET2(2)
C(1) (178-178) C(1) (179-179) PS(7,5) (180-186) PS(7,5) (187-193)
-------------- -------------- ----------------- -----------------

X'40'
X'40' X'F2' X'0000002999970C' X'0000000000000C'X'40'
X'40'
X'40'
X'40' X'F2' X'0000001833315C' X'0000000000000C'X'40'

Modified file with Hex on,COMMAND ===> SCROL
DSORG PS RECFM VB LRECL 1370 Rec# 101 - CAPS ON RDW OFF
FILLER(1) NCHGDETL(2) ACHGDETL(2) ACHGDET2(2)
C(2) (193-194) C(1) (195-195) PS(7,5) (196-202) PS(7,5) (203-209)
-------------- -------------- ----------------- -----------------

X'4040' X'40' X'40404040404040' X'40404040404040'
X'4040' X'F2' X'0000002999970C' X'0000000000000C'X'4040' X'40' X'40404040404040' X'40404040404040'
X'4040' X'40' X'40404040404040' X'40404040404040'
X'4040' X'40' X'40404040404040' X'40404040404040'
X'4040' X'F2' X'0000001833315C' X'0000000000000C'X'4040' X'40' X'40404040404040' X'40404040404040'

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.

Thank You.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Mar 19, 2012 2:13 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Mon Mar 19, 2012 2:56 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Mar 19, 2012 10:58 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Tue Mar 20, 2012 7:29 pm
Reply with quote

Hi Frank,
Exactly you're correct. 've "short records".

Could you please provide a sample JCL for RDW length check.. 'm facing problem in handling RDW length field.

Thank You
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Mar 20, 2012 11:29 pm
Reply with quote

Quote:
Could you please provide a sample JCL for RDW length check.


Code:

   INREC IFTHEN=(WHEN=(1,2,BI,LE,100),BUILD=(...)),
     IFTHEN=(WHEN=(1,2,BI,LE,108,BUILD=(...)),
     ...


For complete information on DFSORT's IFTHEN function, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000088

or "z/OS DFSORT Application Programming Guide at":

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080

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.

BTW, did you ever try my earlier suggestion of:

Code:

  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)


to see if that would do what you want? See my earlier post for an explanation of how that works.
Back to top
View user's profile Send private message
Sriramhari

New User


Joined: 11 May 2009
Posts: 17
Location: Bangalore

PostPosted: Wed Apr 04, 2012 12:16 pm
Reply with quote

Hi All,

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. icon_sad.gif .

Thanks,
R. Vidhya.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top