i have a request that i have fileds that are integer(unit number) and decimal(13,0) (reference number) .
i need to add a number for the current fileds and replce the added number
i.e,
if unit number is 1 i need to add 950000000 to this and replace 1 with 950000001
similarly if reference number is 1 i need to add 8800000000000 and replace 8800000000001
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It's not clear what you want to do.
Where will this reference number come from? Another file? A hardcoded constant? Something else?
Please show an example of the records in your input file or files (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file(s). Give the starting position, length and format of the relevant fields.
I have shown this information from the copy book layout
originall the CITM_UNIT_NBR is integer and CITM_ITM_REF_NBR is decimal(13,0)
If CITM_UNIT_NBR between 0 and 99999 then it must be replaced with 950000000 with actual value added.
If CITM_UNIT_NBR between 100000 and 999999 then it must be replaced with 951000000 with actual value added.
If CITM_UNIT_NBR between 1000000 and 9999999 then it must be replaced with 952000000 with last six digits of actual value added.
If CITM_UNIT_NBR between 10000000 and 99999999 then it must be replaced with 953000000 with last six digits of actual value added.
If CITM_UNIT_NBR > 10000000 then it must be replaced with 954000000 with last six digits of actual value added.
both input and output datasets are Variable block with LRECL=448
CITM_UNIT_NBR starts at position 20 and CITM_ITM_REF_NBR starts at position 34
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
That helps. When you say CITM_UNIT_NBR starts at 20, is that including the RDW in positions 1-4 or does it really start at position 24. Same questions for CITM_ITM_REF_NBR - position 34 or position 38?
Is CITM_UNIT_NBR 9 bytes long? Is CITM_ITM_REF_NBR 13 bytes long?
Your example doesn't really line up at the position you say, but it only matters where those two fields start.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Based on your example and description, you can use a DFSORT job like the following. I assumed you didn't really need to add 8800000000000, but could just overlay in the '880' and add leading zeros for the rest of the number.