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

Sequence Number Update


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

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Thu Jan 19, 2012 6:37 pm
Reply with quote

Hi,

I have a requirement where in I need to update sequence number field at variable position. File is variable length and maximum length is 1014 . Input data will be in below format

<Name>ABC</Name><Address>Address1</Address><City>US</City><DateOfBirth>1983-03-03</DateOfBirth><LocaleCode>VFC</LocaleCode><NameLine>AYUSH</NameLine> <SequenceNum>00000018</SequenceNum><StatusCode>I</StatusCode><Status>Married</Status> <MailID>abc</MailID><Age>23</Age><Telephone>123456</Telephone><SequenceNum>00000021</SequenceNum><Occupation>Student</Occupation><Name>ABC</Name><Add>Address1</Add><SequenceNum>00000021</SequenceNum> <City>US</City><DateOfBirth>1983-03-03</DateOfBirth>

Output will be like this

<Name>ABC</Name><Address>Address1</Address><City>US</City><DateOfBirth>1983-03-03</DateOfBirth><LocaleCode>VFC</LocaleCode><NameLine>AYUSH </NameLine> <SequenceNum>00000001</SequenceNum><StatusCode>I</StatusCode><Status>Married</Status> <MailID>abc</MailID><Age>23</Age><Telephone>123456</Telephone><SequenceNum>00000002</SequenceNum><Occupation>Student</Occupation><Name>ABC</Name><Add>Address1</Add><SequenceNum>00000003</SequenceNum> <City>US</City><DateOfBirth>1983-03-03</DateOfBirth>


How can we achieve this using DFSORT?

Thanks,
Indrajit
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 Jan 19, 2012 6:44 pm
Reply with quote

Can you split it into individual elements, like your last question? The sequence is then in a fixed position.
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Thu Jan 19, 2012 6:47 pm
Reply with quote

I thought of that option first, but now the requirement has changed and they want the input data to be kept as is and just to update the SequenceNum in the same place it is present in the input file.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jan 19, 2012 10:24 pm
Reply with quote

Indrajit_57,

How many times are you going to post the same question? Didn't you try the solution listed here?

www.ibmmainframes.com/viewtopic.php?t=55979&highlight=xml
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sat Jan 21, 2012 4:21 am
Reply with quote

I have tried that solution, reason I m posting this again because of following input change :-

1. One line can have multiple sequence number field.
2. File length is 1014.
3. After modification of previous sort as per new requirement, I m getting output as follow

<Name>ABC</Name><Address>Address1</Address><City>US</City><DateOfBirth>1983-03-03</DateOfBirth><LocaleCode>VFC</LocaleCode><NameLine>AYUSH</NameLine> <SequenceNum>StatusCode>I</StatusCode><Status>Married</Status> <MailID>abc</MailID><Age>23</Age><Telephone>123456</Telephone>00000001</SequenceNum><SequenceNum>Occupation>Student</Occupation><Name>ABC</Name><Add>Address1</Add><SequenceNum> 0000002</SequenceNum><<City>US</City><DateOfBirth>1983-03-03</DateOfBirth>

Modified sort card is

OPTION COPY
INREC IFOUTLEN=1014,
IFTHEN=(WHEN=(1,1014,SS,EQ,C'<SequenceNum>'),
BUILD=(C'"',1,1014),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'"'),
FINDREP=(SHIFT=NO,IN=C'<SequenceNum>',
OUT=C'<SequenceNum>" '),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'"'),
OVERLAY=(1016:SEQNUM,8,FS,C'</SequenceNum>',
1:1,1038,SQZ=(SHIFT=LEFT,PAIR=QUOTE)),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'"'),
FINDREP=(IN=C'"',OUT=C''))
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sat Jan 21, 2012 4:29 am
Reply with quote

Please ignore the above output.
What I am getting now is that the sequence number and the ending tag is always coming at the end of the record and not following the start of the sequence number tag.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Jan 21, 2012 5:21 am
Reply with quote

Indrajit_57,

DFSORT does NOT have any feature to handle multiple occurrences of the <SequenceNum> tags and update them. A simple COBOL program should be able to do this easily.
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 Jan 23, 2012 9:38 pm
Reply with quote

Indrajit_57,

Are you OK with this now?

You have the rexx example enrico posted on a previous question. I can get to the following with Cobol, if you have need of more than the sequence number. If you just need the sequence, even simpler:
Code:

0019ENTRIES
FOR NUMBER =0001= ENTRY
XML IS  =<NAME>ABC</NAME>=
TAG IS  =<NAME>=
DATA IS =ABC=
FOR NUMBER =0002= ENTRY
XML IS  =<ADDRESS>ADDRESS1</ADDRESS>=
TAG IS  =<ADDRESS>=
DATA IS =ADDRESS1=
FOR NUMBER =0003= ENTRY
XML IS  =<CITY>US</CITY>=
TAG IS  =<CITY>=
DATA IS =US=
FOR NUMBER =0004= ENTRY
XML IS  =<DATEOFBIRTH>1983-03-03</DATEOFBIRTH>=
TAG IS  =<DATEOFBIRTH>=
DATA IS =1983-03-03=
FOR NUMBER =0005= ENTRY
XML IS  =<LOCALECODE>VFC</LOCALECODE>=
TAG IS  =<LOCALECODE>=
DATA IS =VFC=
FOR NUMBER =0006= ENTRY
XML IS  =<NAMELINE>AYUSH</NAMELINE>=
TAG IS  =<NAMELINE>=
DATA IS =AYUSH=
FOR NUMBER =0007= ENTRY
XML IS  =<SEQUENCENUM>00000018</SEQUENCENUM>=
TAG IS  =<SEQUENCENUM>=
DATA IS =00000018=
FOR NUMBER =0008= ENTRY
XML IS  =<STATUSCODE>I</STATUSCODE>=
TAG IS  =<STATUSCODE>=
DATA IS =I=
FOR NUMBER =0009= ENTRY
XML IS  =<STATUS>MARRIED</STATUS>=
TAG IS  =<STATUS>=
DATA IS =MARRIED=
FOR NUMBER =0010= ENTRY
XML IS  =<MAILID>ABC</MAILID>=
TAG IS  =<MAILID>=
DATA IS =ABC=
FOR NUMBER =0011= ENTRY
XML IS  =<AGE>23</AGE>=
TAG IS  =<AGE>=
DATA IS =23=
FOR NUMBER =0012= ENTRY
XML IS  =<TELEPHONE>123456</TELEPHONE>=
TAG IS  =<TELEPHONE>=
DATA IS =123456=
FOR NUMBER =0013= ENTRY
XML IS  =<SEQUENCENUM>00000021</SEQUENCENUM>=
TAG IS  =<SEQUENCENUM>=
DATA IS =00000021=
FOR NUMBER =0014= ENTRY
XML IS  =<OCCUPATION>STUDENT</OCCUPATION>=
TAG IS  =<OCCUPATION>=
DATA IS =STUDENT=
FOR NUMBER =0015= ENTRY
XML IS  =<NAME>ABC</NAME>=
TAG IS  =<NAME>=
DATA IS =ABC=
FOR NUMBER =0016= ENTRY
XML IS  =<ADD>ADDRESS1</ADD>=
TAG IS  =<ADD>=
DATA IS =ADDRESS1=
FOR NUMBER =0017= ENTRY
XML IS  =<SEQUENCENUM>00000021</SEQUENCENUM>=
TAG IS  =<SEQUENCENUM>=
DATA IS =00000021=
FOR NUMBER =0018= ENTRY
XML IS  =<CITY>US</CITY>=
DATA IS =US=
FOR NUMBER =0019= ENTRY
XML IS  =<DATEOFBIRTH>1983-03-03</DATEOFBIRTH>=
TAG IS  =<DATEOFBIRTH>=
DATA IS =1983-03-03=
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 Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top