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

Add value To a particular Filed in the Record


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Thu Aug 25, 2011 5:09 pm
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
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
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
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
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
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Thu Aug 25, 2011 7:12 pm
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
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
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
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

Moderator Emeritus


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

PostPosted: Thu Aug 25, 2011 8:05 pm
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
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
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: 2481
Location: @my desk

PostPosted: Thu Aug 25, 2011 9:13 pm
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 Developer


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

PostPosted: Thu Aug 25, 2011 11:32 pm
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

Moderator Emeritus


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

PostPosted: Fri Aug 26, 2011 3:38 am
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
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
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Aug 26, 2011 2:49 pm
Reply with quote

I don't understand. This is twice now this week. You post a question, people are helping you out, a solution (or several) is possibile, then you give up and write a Cobol program. Which you don't like. Your skills say "pli", so why not that?

If you next ask a question, would you prefer us to say "how about writing a Cobol program"? Just so we know.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Aug 26, 2011 2:59 pm
Reply with quote

Frank Yaeger wrote:
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.

Thanks Frank...
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 6:36 pm
Reply with quote

Bill Woodger wrote:
I don't understand. This is twice now this week. You post a question, people are helping you out, a solution (or several) is possibile, then you give up and write a Cobol program. Which you don't like. Your skills say "pli", so why not that?

If you next ask a question, would you prefer us to say "how about writing a Cobol program"? Just so we know.


Yaa sorry Bill... icon_sad.gif I know... But Im still trying with SYNCSORT parallely to learn that but its still not happening....

Its was an immediate requirement and had to finish it quickly so coded it in COBOL last evening.... And ya PLI is my expertise but that was in my last project...... here they don use PLi or Easytrieve... so coded in COBOL....

And if u don mind can u please help me on an IMS Loading thing in IMS forum.... icon_smile.gif
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: Fri Aug 26, 2011 7:00 pm
Reply with quote

I think enrico has dealt with your IMS load question. It is not generally a good thing to solicit answers here. Where people have time/skills they provide replies at their own choice.

My IMS skills are almost limited to being able to spell it.

With this SyncSort question, you have two routes: check that TO=ZD is getting you a signed value (C), not unsigned (F) and find how to get an unsigned value; do the IFTHEN stuff for 1, 2, other for each of your dates, inserting 9, 0, TBD respectively.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Aug 26, 2011 7:04 pm
Reply with quote

Quote:
I think enrico has dealt with your IMS load question.


not probably the way the TS expected,
but that' s the reply he deserved, for an unload use the <corresponding>... load

what else could be replied ? icon_cool.gif
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts Sort based on the record type DFSORT/ICETOOL 1
Search our Forums:

Back to Top