Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Add value To a particular Filed in the Record
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 5:02 pm    Post subject: Add value To a particular Filed in the Record
Reply with quote

Hi All.....

I have an Input file which contains records containing policy information...... and one of the fields in the record is the date field of character 7.....

I now need to add 18000000 to all the dates field whose position in the record is known....

For Ex..

I/P File

NARAIBM2081221JCLFORUM
NARAIBM2091121IMSFORUM

now the date field starts at location 8 and the value is 2081221
i have to add 18000000 to this value to make it 20081221 before writing it to the o/p file and in the same way 2091121 becomes 20091121

NARAIBM20081221JCLFORUM
NARAIBM20091121IMSFORUM

could you please let me know how to accomplish this....
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Aug 25, 2011 5:09 pm    Post subject: Reply to: Add value To a particular Filed in the Record
Reply with quote

So really you have to insert a "0" at a specific position, by which I mean also shifting everything after where you want the new zero to be, one byte to the right?

Recfm/lrecl for input and output, please.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 5:13 pm    Post subject:
Reply with quote

Below DFSORT step will give you desired output...

Assuming your input is 22 byte FB and so Output as 23 byte....
Code:

//S1    EXEC  PGM=ICEMAN                                     
//SYSOUT    DD  SYSOUT=*                                     
//SORTIN DD *                                               
NARAIBM2081221JCLFORUM                                       
NARAIBM2091121IMSFORUM                                       
/*                                                           
//SORTOUT DD SYSOUT=*                                       
//SYSIN    DD    *                                           
   OPTION COPY                                               
   INREC BUILD=(1,7,8,7,ZD,ADD,+18000000,TO=ZD,LENGTH=8,15,8)

Output will be
Code:

NARAIBM20081221JCLFORUM
NARAIBM20091121IMSFORUM
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 6:07 pm    Post subject: Re: Reply to: Add value To a particular Filed in the Record
Reply with quote

Bill Woodger wrote:
So really you have to insert a "0" at a specific position, by which I mean also shifting everything after where you want the new zero to be, one byte to the right?

Recfm/lrecl for input and output, please.


Its not always Zero coz if date is 1881221 then the o/p would be 19881221...


@ Escapa - thanks very much for the code.... ll try that now.....
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 6:24 pm    Post subject:
Reply with quote

Escapa wrote:
Below DFSORT step will give you desired output...

Assuming your input is 22 byte FB and so Output as 23 byte....
Code:

//S1    EXEC  PGM=ICEMAN                                     
//SYSOUT    DD  SYSOUT=*                                     
//SORTIN DD *                                               
NARAIBM2081221JCLFORUM                                       
NARAIBM2091121IMSFORUM                                       
/*                                                           
//SORTOUT DD SYSOUT=*                                       
//SYSIN    DD    *                                           
   OPTION COPY                                               
   INREC BUILD=(1,7,8,7,ZD,ADD,+18000000,TO=ZD,LENGTH=8,15,8)

Output will be
Code:

NARAIBM20081221JCLFORUM
NARAIBM20091121IMSFORUM


Hi Escapaa... thanks for the soln.... its working.. But i have one problem....

I am getting a hexadecimnal valure at the end of the date

2080422 is getting converted as 2008042B

why is B coming at the end???
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 6:40 pm    Post subject:
Reply with quote

Show us input used and SYSOUT of the execution (use code tags)
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 6:55 pm    Post subject:
Reply with quote

Escapa wrote:
Show us input used and SYSOUT of the execution (use code tags)


The input was a larger file of length 799

Code:
SOLI82    20804223.......


SYSIN

Code:
OPTION COPY                                           
INREC BUILD=(1,10,11,7,ZD,ADD,+18000000,TO=ZD,LENGTH=8)


the output was

Code:
SOLI82    20080422B...


Sysout

Code:
SYSIN :                                                                     
  OPTION COPY                                                               
  INREC BUILD=(1,10,11,7,ZD,ADD,+18000000,TO=ZD,LENGTH=8)                   
WER276B  SYSDIAG= 3640, 273707, 273707, 372600                             
WER164B  5,888K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,         
WER164B     0 BYTES RESERVE REQUESTED, 2,256K BYTES USED                   
WER146B  4K BYTES OF EMERGENCY SPACE ALLOCATED                             
WER108I  SORTIN   : RECFM=FB   ; LRECL=   799; BLKSIZE= 27965               
WER257I  INREC RECORD LENGTH =    18                                       
WER110I  SORTOUT  : RECFM=FB   ; LRECL=   799; BLKSIZE= 27965               
WER462I  OUTPUT LRECL DIFFERS FROM SORTOUT LRECL                           
WER410B  4,860K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,   
WER410B     0 BYTES RESERVE REQUESTED, 2,112K BYTES USED                   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                               
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                               
WER416B  SORTIN   : EXCP'S=1,UNIT=3390,DEV=F209,CHP=(015191A1,4),VOL=RLDA07
WER416B  SORTOUT  : EXCP'S=1,UNIT=3390,DEV=530A,CHP=(005090A0,4),VOL=RLDA02
WER416B  TOTAL OF 2 EXCP'S ISSUED FOR COPYING                               
WER054I  RCD IN         50, OUT         50                                 
 WER169I  RELEASE 1.3 BATCH 0493 TPF LEVEL 1.1                                 
 WER052I  END SYNCSORT - L20456CP,STEP02B,,DIAG=A800,7386,80AE,004C,E052,4CAB,02E8,6462
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 7:03 pm    Post subject:
Reply with quote

You don't have DFSORT at your shop. You have SYNCSORT.

Solution I provided is for DFSORT (with default ZDPRINT option)

I am not sure if how to specify this option in case of SYNCSORT.


For DFSORT you need to use OPTION ZDPRINT if in case your default is NZDPRINT.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 7:11 pm    Post subject:
Reply with quote

I did bit of search on JCL part of forum.. So I could see that OPTION ZDPRINT can be specified for SYNCSORT too
http://ibmmainframes.com/post-77855.html
So try below
Code:

//SYSIN    DD    *                                           
   OPTION COPY,ZDPRINT                                               
   INREC BUILD=(1,7,8,7,ZD,ADD,+18000000,TO=ZD,LENGTH=8,15,8)
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 7:11 pm    Post subject:
Reply with quote

ohhh ok.... thank u escapa....

i might have to write a cobol program if no option is available in syncsort.... icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Aug 25, 2011 7:12 pm    Post subject: Reply to: Add value To a particular Filed in the Record
Reply with quote

Quote:
WER110I SORTOUT : RECFM=FB ; LRECL= 799; BLKSIZE= 27965
WER462I OUTPUT LRECL DIFFERS FROM SORTOUT LRECL


I don't think it is to do with your problem, but you haven't adjusted the lrecl for your output file.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 7:15 pm    Post subject:
Reply with quote

Escapa wrote:
I did bit of search on JCL part of forum.. So I could see that OPTION ZDPRINT can be specified for SYNCSORT too
http://ibmmainframes.com/post-77855.html
So try below
Code:

//SYSIN    DD    *                                           
   OPTION COPY,ZDPRINT                                               
   INREC BUILD=(1,7,8,7,ZD,ADD,+18000000,TO=ZD,LENGTH=8,15,8)


I tried this.... It still gives me the same output with the hexadecimal character at end....
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 7:16 pm    Post subject: Re: Reply to: Add value To a particular Filed in the Record
Reply with quote

Bill Woodger wrote:
Quote:
WER110I SORTOUT : RECFM=FB ; LRECL= 799; BLKSIZE= 27965
WER462I OUTPUT LRECL DIFFERS FROM SORTOUT LRECL


I don't think it is to do with your problem, but you haven't adjusted the lrecl for your output file.


Thanks Bill... changed that... icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Aug 25, 2011 8:05 pm    Post subject: Reply to: Add value To a particular Filed in the Record
Reply with quote

Can you give us input and output for say, 10 records, and at least 40 characters around your date, and a HEX display if you have non-display data in any positions in that part of the file.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Aug 25, 2011 8:30 pm    Post subject:
Reply with quote

@ Bill - Please find the details below.

Input

Columns b/w 10-17 and 36-42 are the date fields

Code:
SOLI82    208042230405245301Z 000012080422REGL
SOLI82    208052230405245301Z 000012080522REGL
SOLI82    208062230405245301Z 000012080622REGL
SOLI82    208063030405245301Z 002022080522REGL
SOLI82    208063030405245301Z 002022080622REGL
SOLI82    208063030405245301Z 002032080522REGL
SOLI82    208072230405245301Z 000012080722REGL
SOLI82    208072230405245301Z 002022080722REGL
SOLI82    208082230405245301Z 000012080822REGL


output

The converted date can be seen below. 2008042B is one sample example

Code:
SOLI82    2008042B30405245301Z 000012008042BREGL
SOLI82    2008052B30405245301Z 000012008052BREGL
SOLI82    2008062B30405245301Z 000012008062BREGL
SOLI82    2008063{30405245301Z 002022008052BREGL
SOLI82    2008063{30405245301Z 002022008062BREGL
SOLI82    2008063{30405245301Z 002032008052BREGL
SOLI82    2008072B30405245301Z 000012008072BREGL
SOLI82    2008072B30405245301Z 002022008072BREGL
SOLI82    2008082B30405245301Z 000012008082BREGL


Hex form of the date field

Code:
2008042B
FFFFFFFC
20080422
--------
2008052B
FFFFFFFC
20080522
--------
2008062B
FFFFFFFC
20080622
--------
2008063{
FFFFFFFC
20080630
--------
2008063{
FFFFFFFC
20080630
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Thu Aug 25, 2011 9:02 pm    Post subject:
Reply with quote

How about trying a Simple solution that I have used -- OLD TIME IEBGENER

My input record is 80 bytes long -- but the length can be changed to
fit the size of the incoming record.

IEBGENER:
1. moves the first 8 bytes to the first 8 bytes of the o/p record
2. moves one ZERO to position 9 of the output record
3. moves the rest of the record to the output record starting at
position 10

//IEBGEN1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
NARAIBM2081221JCLFORUM
NARAIBM2091121IMSFORUM
//SYSUT2 DD SYSOUT=*,
// DCB=(LRECL=080,BLKSIZE=0,RECFM=FB,DSORG=PS)
//SYSIN DD *
GENERATE MAXFLDS=30,MAXLITS=30
RECORD FIELD=(8,1,,1),FIELD=(1,'0',,9),FIELD=(71,09,,10)

======== PRODUCES ========

NARAIBM20081221JCLFORUM
NARAIBM20091121IMSFORUM
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Thu Aug 25, 2011 9:13 pm    Post subject:
Reply with quote

narasimha.g,

Changing the TO=ZD to TO=ZDF should solve your problem.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 25, 2011 11:32 pm    Post subject:
Reply with quote

Quote:
For DFSORT you need to use OPTION ZDPRINT if in case your default is NZDPRINT.


With DFSORT: ZDPRINT only applies to SUM, not INREC. TO=ZD (the default) or TO=ZDF gives an F sign for positive values. TO=ZDC gives a C sign for position values.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 26, 2011 3:38 am    Post subject: Reply to: Add value To a particular Filed in the Record
Reply with quote

narasimha.g,

You are getting a "signed" value after your addition. Ie, the sign-half-byte (left part of the final byte) is getting set to "C", whereas you would prefer to see it as an "F", an "unsigned" value.

I don't have a SYNCSORT manual. You'll have to look at numeric types in your manual, and see how to define an unsigned field, instead of using ZD.

Now that I see you have two dates, remember to add another byte to your output Lrecl :-)

Ridgewalker's solution would work for you if you could get the condition in, first digit of date is "1", insert "9" after "1". First digit of date is "2", insert "0".

You can also do it that way in the SORT. If you do, I'd hope that you cover the "unexepected" when it is neither 1 nor 2 :-)
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Fri Aug 26, 2011 2:39 pm    Post subject:
Reply with quote

Thanks all for the suggestions.... icon_smile.gif

I couldn get the desired o/p using Syncsort and hence had to write cobol program (which i hate to)......
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us