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

Changing the size of a field


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Wed Feb 21, 2007 6:28 pm
Reply with quote

Hi all,
I have an input file FB of LRECL 80 with only 1 column.Each record in the input file is of different length..
Eg:
Code:

00456789
56890
003788906
3452678


1.I need the O/P file with a length of 21 characters with zeros padded in front of the field..
Eg:
Code:

000000000000000456789
000000000000000056890
000000000000003788906
000000000000003452678


2.Also I need to add ' ' and a comma at the end of the column
Eg:
Code:

'000000000000000456789',
'000000000000000056890',
'000000000000003788906',
'000000000000003452678',


Thanks
Aneeta
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: Wed Feb 21, 2007 10:19 pm
Reply with quote

Aneeta,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
00456789
56890
003788906
3452678
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'''',1,21,UFF,M11,LENGTH=21,C''',',80:X)
/*
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Thu Feb 22, 2007 11:56 am
Reply with quote

It worked..Thanks a lot Frank..
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Thu Feb 22, 2007 6:15 pm
Reply with quote

Hi Frank,
I have 1 more additional requirement now..I need to add ( in the first record and ) in the last record along with ;(semicolon).

Eg:
('000000000000000456789',
'000000000000000056890',
'000000000000003788906',
'000000000000003452678');

Note:The last record will not contain ,(comma).

Pls help me..Pls let me know if I had to open a new POST for this and I would do.

Thanks
Aneeta
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 Feb 22, 2007 10:17 pm
Reply with quote

Aneeta,

That's a bit trickier, but here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
00456789
56890
003788906
3452678
/*
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(81:SEQNUM,8,ZD)
* Add seqnums to input file.
  OUTFIL FNAMES=T1
* Create symbol for last record as:
* LASTRCD,+nnnnnnnn
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    BUILD=(1,80),
    TRAILER1=('LASTRCD,+',81,8)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
* Reformat each record to:
* 'ddddddddddddddddddddd',
     IFTHEN=(WHEN=INIT,
      BUILD=(C'''',1,21,UFF,M11,LENGTH=21,C''',',81:81,8)),
* Use seqnum = +1 to identify first record and
* reformat it to:
* ('ddddddddddddddddddddd',
     IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
      BUILD=(C'(',1,24)),
* Use seqnum = LASTRCD to identify last record and
* reformat it to:
* 'ddddddddddddddddddddd');
     IFTHEN=(WHEN=(81,8,ZD,EQ,LASTRCD),
      OVERLAY=(24:C');'))
/*
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Thu Apr 05, 2007 12:16 pm
Reply with quote

Hi Frank,
Thanks for the help.The JCL is working perfectly fine.But I am facing an issue when the input is only one record.

Eg:('000000000003452678'...the closing paranthese and semicolon is missing..

Pls help me..

Thanks
Aneeta
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 Apr 05, 2007 8:21 pm
Reply with quote

Aneeta,

Just change the control statements for the S2 step to:

Code:

  OPTION COPY
  INREC IFOUTLEN=80,
* Reformat each record to:
* 'ddddddddddddddddddddd',
     IFTHEN=(WHEN=INIT,
      BUILD=(C'''',1,21,UFF,M11,LENGTH=21,C''',',81:81,8)),
* Use seqnum = +1 and seqnum = LASTRCD to handle only
* one record and reformat it to:
* ('ddddddddddddddddddddd');
     IFTHEN=(WHEN=(81,8,ZD,EQ,+1,AND,81,8,ZD,EQ,LASTRCD),
      BUILD=(C'(',1,23,C');')),
* Use seqnum = +1 to identify first record and
* reformat it to:
* ('ddddddddddddddddddddd',
     IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
      BUILD=(C'(',1,24)),
* Use seqnum = LASTRCD to identify last record and
* reformat it to:
* 'ddddddddddddddddddddd');
     IFTHEN=(WHEN=(81,8,ZD,EQ,LASTRCD),
      OVERLAY=(24:C');'))
Back to top
View user's profile Send private message
aneeta

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Wed Apr 11, 2007 8:56 pm
Reply with quote

Thanks Frank
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top