يَا طَالِبَ الْعِلْمِ، اجْتَهِدْ
O seeker of knowledge, work diligently.
Yā is the vocative particle; ṭāliba is a vocative in an iḍāfah construction and is accusative; al-ʿilmi is its genitive complement. Ijtahid is an imperative following the call.
يَا زَيْدُ
O Zayd!
Here the proper noun Zaydu is built on ḍammah while occupying the syntactic position of an accusative vocative. Outward case form and syntactic position need not be identical.